ember-dayjs-helpers
v0.5.15
Published
Ember Template helpers based on Day.js
Downloads
457
Maintainers
Readme
ember-dayjs-helpers
30+ Ember.js template helpers based on day.js, a fast 2kB alternative to Moment.js with the same modern API
Installation
ember install ember-dayjs-helpers
Usage
View the Demo page for more examples.
Using in templates
{{ day-js }} => Display today's date
{{ day-js date='2019-01-25' format='DD-MM-YYYY'}} => 25-01-2019
{{ day-js date='2019-01-25' format='DD MMMM YYYY'}} => 25 January 2019
Using inside Javascript
import dayjs from 'dayjs';
...
const yesterday = dayjs().subtract(1, 'day').toString()
const tomorrow = dayjs().add(1, 'day').toString()
const lastWeek = dayjs().subtract(1, 'week').toString()
const nextWeek = dayjs().add(1, 'week').toString()
const lastMonth = dayjs().subtract(1, 'month').toString()
const nextMonth = dayjs().add(1, 'month').toString()
const lastYear = dayjs().subtract(1, 'year').toString()
const nextYear = dayjs().add(1, 'year').toString()
Helpers
Display Helpers
- day-js
- dayjs-format
- dayjs-from
- dayjs-from-now
- dayjs-to
- dayjs-to-now
- dayjs-calendar
- dayjs-diff
- days-in-month
- dayjs-date
- dayjs-day-of-week
- dayjs-weekday
- dayjs-day-of-year
- dayjs-week-of-year
Manipulate Helpers
- dayjs-add
- dayjs-subtract
- dayjs-start-of
- dayjs-end-of
Query Helpers
- dayjs-is-before
- dayjs-is-same
- dayjs-is-after
- dayjs-is-same-or-before
- dayjs-is-same-or-after
- dayjs-is-between
- dayjs-is-leap-year
i18n Helpers
- dayjs-weekdays
- dayjs-weekdays-short
- dayjs-weekdays-min
- dayjs-months
- dayjs-months-short
Compatibility
- Ember.js v3.12 or above
- Ember CLI v2.13 or above
- Node.js v10 or above
Contributing
See the Contributing guide for details.
License
This project is licensed under the MIT License.