https://github.com/bestguy/ractive-datetime
RactiveJS date/time format helper
https://github.com/bestguy/ractive-datetime
Last synced: 10 months ago
JSON representation
RactiveJS date/time format helper
- Host: GitHub
- URL: https://github.com/bestguy/ractive-datetime
- Owner: bestguy
- License: mit
- Created: 2016-05-29T06:45:51.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-27T02:48:44.000Z (over 9 years ago)
- Last Synced: 2025-08-09T13:58:11.866Z (10 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Ractive Date/Time helper
A date and time format mustache helper for [Ractive](http://www.ractivejs.org/),
using [fecha](https://github.com/taylorhakes/fecha)
----
## Usage
_Note: this helper is a self-registering CommonJS module, and in the browser
requires a module system such as Webpack or Browserify._
npm install ractive-datetime
### ES5:
```js
var Ractive = require('ractive');
require('ractive-date-time');
```
### ES6/2015+:
```js
import Ractive from 'ractive';
import 'ractive-date-time';
```
### In Ractive template:
{{datetime(some_date, 'MMMM Do, YYYY')}}
{{datetime(some_date, 'H:mmA')}}
#### Outputs:
May 28th, 2016
9:15AM
Full format options are [here](https://github.com/taylorhakes/fecha#formatting-tokens).
**Note: Relative dates using `fromNow` helper have been removed in version 1.x. to reduce dependency sizes.**
If you need this, please use the older 0.1.x versions:
`npm install ractive-datetime@0.1`