https://github.com/helpers/handlebars-helper-datetime
Handlebars helper for adding RFC-822 formatted datetimes to XML feeds
https://github.com/helpers/handlebars-helper-datetime
Last synced: 6 months ago
JSON representation
Handlebars helper for adding RFC-822 formatted datetimes to XML feeds
- Host: GitHub
- URL: https://github.com/helpers/handlebars-helper-datetime
- Owner: helpers
- License: mit
- Created: 2014-01-21T08:19:13.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-01-21T08:24:21.000Z (almost 12 years ago)
- Last Synced: 2025-06-11T15:40:14.104Z (7 months ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# {{datetime}} [](http://badge.fury.io/js/handlebars-helper-datetime)
> Handlebars helper for adding RFC-822 formatted datetimes to XML feeds
## Installation
Use [npm](npmjs.org) to install the package:
```bash
npm i handlebars-helper-datetime --save-dev
```
Use [bower](https://github.com/bower/bower) to install the package:
```bash
bower install handlebars-helper-datetime --save-dev
```
## Usage
With the helper registered, you may now begin using it in your templates:
Use "now" as the date
```handlebars
{{datetime}}
```
Or pass in a context
```handlebars
{{datetime page.date}}
```
Results in
```yaml
Tue, 21 Jan 2014 03:08:11 -0500
```
## Usage with [Assemble](http://assemble.io)
The easiest way to register the helper with [Assemble](https://github.com/assemble/assemble) is to add the module to both `devDependencies` and `keywords` in your project's package.json:
```json
{
"devDependencies": {
"handlebars-helper-datetime": "*"
},
"keywords": [
"handlebars-helper-datetime"
]
}
```
Alternatively, to register the helper explicitly in the Gruntfile:
```javascript
grunt.initConfig({
assemble: {
options: {
// the 'handlebars-helper-datetime' npm module must also be listed in
// devDependencies for assemble to automatically resolve the helper
helpers: ['handlebars-helper-datetime', 'foo/*.js']
},
files: {
'dist/': ['src/templates/*.hbs']
}
}
});
```
## Author
[**Jon Schlinkert**](http://github.com/jonschlinkert)
+ [github/jonschlinkert](http://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License and Copyright
Licensed under the [MIT License](./LICENSE-MIT).
Copyright (c) 2014 [Jon Schlinkert](http://github.com/jonschlinkert), contributors.