Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
shinnn committed Jun 15, 2018
0 parents commit fe0412e
Show file tree
Hide file tree
Showing 10 changed files with 3,854 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = tab
tab_width = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.{md,yml}]
indent_style = space

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
* text=auto
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
.nyc_output
coverage
node_modules
9 changes: 9 additions & 0 deletions .travis.yml
@@ -0,0 +1,9 @@
branches:
except: /^v\d/
language: node_js
node_js: node
after_script: node_modules/.bin/nyc report --reporter=text-lcov | npx coveralls
env:
global:
- COVERALLS_SERVICE_NAME=travis-pro
- secure: i6O9ZYcS5l1zAJCne1uM57TTxvXBShLHUi3PNPalSETR8C4xH4qDiiLoKDh+lzbAiKhDz0F4Xap1rQlC5sBWCtzQMpPZuULXdarWnmJS+el8Mgu0/D+jPi1IUfvJ6CtVpwGeHz2fuad7uEiPvjInMLXQVilzcn/kR/AKxKMet5Xk0fybmqzV1H4ClEPq/apHpfhSFib5AisnxXkDLDb4lLtlTVYsP39lCSvmsyDy1oTO8gTFYB8d/F28FQXu0KDl00cKDhBSWQRSWhHgOOiU/VxRtJ61u54PvLBUQ8aXfJjS7kk+gD4xfhdjznGtqxddWPIC5DhJCpzOguYQry6QKUgwpG5PTslTan4R4K45/WEdiBWTbHYEPcxtG+6SQYwdYIhxtlC06NLTAJEQvL3kMrlU5AKRrJag2u/wMmSr6/9pM2jM9/eNo6YN033m4LZR01VJ8H8Hp/JmTBLR3zzSEjGVA23KLBBDb6ORPMG5RZAxJoEjKnTN58TfBDlicc04LVNc87VC2t6uWnGHUloleR+iCADxLm7Wi9zQsc5vMl5Jjdm+AqwcA3UAABto26Gtiap3lP1ejV+DvypndURtcsPckZJvHYZzIdWj1HdOCUtAilBboPNA9krG/WamiJFpJgEj7qjKQhHF0Iv9Psg8/bZ6pmh9ofjJv+kZKHc5wxk=
6 changes: 6 additions & 0 deletions LICENSE
@@ -0,0 +1,6 @@
ISC License (ISC)
Copyright 2018 Shinnosuke Watanabe

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
51 changes: 51 additions & 0 deletions README.md
@@ -0,0 +1,51 @@
# current-exif-date

[![npm version](https://img.shields.io/npm/v/current-exif-date.svg)](https://www.npmjs.com/package/current-exif-date)
[![Build Status](https://travis-ci.com/shinnn/current-exif-date.svg?branch=master)](https://travis-ci.com/shinnn/current-exif-date)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/current-exif-date.svg)](https://coveralls.io/github/shinnn/current-exif-date?branch=master)

Get the current date as an Exif date format

```javascript
const currentExifDate = require('current-exif-date');

currentExifDate(); //=> '2018:06:15 10:13:05'
```

According to the [Exif specification (PDF)](http://www.cipa.jp/std/documents/e/DC-008-Translation-2016-E.pdf), the format of `DateTime`, `DateTimeOriginal` and `DateTimeDigitaized` is:

> "YYYY:MM:DD HH:MM:SS" with time shown in 24-hour
format, and the date and time separated by one blank character

## Installation

[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).

```
npm install current-exif-date
```

## API

```javascript
const currentExifDate = require('current-exif-date');
```

### currentExifDate()

Return: `string`

Note that the resultant date indicates the *local* time.

```javascript
// In Japan

new Date().toString(); //=> 'Fri Jun 15 2018 01:04:30 GMT+0900 (JST)'
new Date().toUTCString(); //=> 'Thu, 14 Jun 2018 16:04:30 GMT'

currentExifDate(); //=> '2018:06:15 01:04:30', not '2018:06:14 01:04:30 16:04:30'
```

## License

[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe
16 changes: 16 additions & 0 deletions index.js
@@ -0,0 +1,16 @@
'use strict';

var format = require('exif-date').format;

module.exports = function currentExifDate() {
var currentDate = new Date();

return format(new Date(Date.UTC(
currentDate.getFullYear(),
currentDate.getMonth(),
currentDate.getDate(),
currentDate.getHours(),
currentDate.getMinutes(),
currentDate.getSeconds()
)));
};

0 comments on commit fe0412e

Please sign in to comment.