ember-date-fns
v0.5.0
Published
Date helpers for Ember.js using date-fns
Downloads
172
Readme
Ember date-fns
Lightweight date helpers for your ember-cli application thanks to date-fns. If all you need is to format a date, Ember date-fns will help you.
If you are looking for more features, see ember-moment instead.
Installation
In your ember-cli project, run either
ember install ember-date-fns
or
yarn add ember-date-fns
or
npm install --save ember-date-fns
Available helpers
All helpers map to the date-fns function of the same name.
Usage
date-format
Uses format to format a date object, string or timestamp.
{{date-format date "D. MMM YYYY"}}
date-from-now
Uses distanceInWordsToNow to return "time ago". By default no suffix is added.
{{date-from-now date addSuffix=true}}
Exposing additional date-fns
date-fns
provides many functions for manipulating dates. In order to reduce bundle size only date-fns/distance_in_words_to_now
and date-fns/format
helpers are included by default. However you can import any functions anywhere in your application.
Example:
// app/components/some-component.js
import Ember from 'ember';
import endOfDay from 'date-fns/end_of_day';
// Your component code here...