ember-date-fns

0.5.0 • Public • Published

Ember date-fns

npm version CircleCI

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...

Package Sidebar

Install

npm i ember-date-fns

Weekly Downloads

93

Version

0.5.0

License

MIT

Unpacked Size

7.37 kB

Total Files

14

Last publish

Collaborators

  • n1ru4l
  • oskarrough