Ember date helpers with locale support.
MIT License
Ember date helpers with locale support.
This addon includes time-ago-in-words
, time-ahead-in-words
, time-delta-in-words
,
time-format
, day-of-the-week
, date-and-time
, month-and-day
, month-and-year
.
It uses moment.js.
ember install:addon ember-cli-dates
Now, in your views/templates/components:
{{time-ago-in-words createdAt}} {{! => twelve days ago}}
{{time-ahead-in-words toBePublishedAt}} {{! => in 4 hours}}
{{time-delta-in-words completedAt}} {{! => 7 minutes ago}}
{{month-and-day completedAt}} {{! => Jan 1st}}
{{month-and-day completedAt}} {{! => jan 1º}}
{{month-and-year completedAt 'pt-br'}} {{! => Jan 2015}}
{{date-and-time publishedAt}} {{! January 1, 2014 12:00 AM}}
{{date-and-time publishedAt 'pt-br'}} {{! 1 de janeiro de 2014 às 00:00}}
{{time-format updatedAt 'l'}} {{! => 10/9/2014}}
{{day-of-the-week someDate}} {{! => Friday}}
In order to add locale support, you need to import the locale file in your app's Brocfile.js
:
app.import(app.bowerDirectory + '/moment/locale/pt-br.js');
You then have the ability to specify any imported locale with:
{{time-format createdAt 'LLLL' 'pt-br'}}
{{time-ahead-in-words nextHour 'pt-br'}}
MIT
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Crafted with <3 by John Otander(@4lpine).