Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Added options for adding timezone #6

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@

# metalsmith-build-date
# metalsmith-build-date-tz

A Metalsmith plugin that adds a build date to the metadata. Useful for `atom.xml` or other feeds.

## Installation

$ npm install metalsmith-build-date
$ npm install https://github.com/brianfidler/metalsmith-build-date-tz.git

## Usage

```js
var date = require('metalsmith-build-date');
var date = require('metalsmith-build-date-tz');

metalsmith.use(date());
```
Expand Down Expand Up @@ -39,12 +39,12 @@ metalsmith.use(date({ key: 'dateBuilt' ));

## CLI Usage

Install via npm and then add the `metalsmith-build-date` key to your `metalsmith.json`:
Install via npm and then add the `metalsmith-build-date-tz` key to your `metalsmith.json`:

```json
{
"plugins": {
"metalsmith-build-date": true
"metalsmith-build-date-tz": true
}
}
```
Expand Down
11 changes: 10 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ function plugin(options) {

return function(files, metalsmith, done){
var data = metalsmith.metadata();
data[options.key] = new Date();

today = new Date();

//modified date to display EST
options.timeZone = 'America/New_York';
options.timeZoneName = 'short';
today = today.toLocaleString('en-US', options);
//

data[options.key] = today;
done();
};
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "metalsmith-build-date",
"description": "A Metalsmith plugin that adds a build date to the metadata.",
"repository": "git://github.com/segmentio/metalsmith-build-date.git",
"description": "A Metalsmith plugin that adds a build date to the metadata, and also allows timezone to be added.",
"repository": "git://github.com/brianfidler/metalsmith-build-date-tz.git",
"version": "0.2.0",
"license": "MIT",
"main": "lib/index.js",
"devDependencies": {
"mocha": "1.x",
"metalsmith": "0.x"
}
}
}