Code Monkey home page Code Monkey logo

ember-cli-dates's Introduction

ember-cli-dates Build Ember Observer Score

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.

Installation

ember install:addon ember-cli-dates

Usage

Now, in your views/templates/components:

Time Deltas

Time Ago in Words

{{time-ago-in-words createdAt}} {{! => twelve days ago}}

Time Ahead in Words

{{time-ahead-in-words toBePublishedAt}} {{! => in 4 hours}}

Time Delta in Words

{{time-delta-in-words completedAt}} {{! => 7 minutes ago}}

Month and Day

{{month-and-day completedAt}} {{! => Jan 1st}}
{{month-and-day completedAt}} {{! => jan 1º}}

Month and Year

{{month-and-year completedAt 'pt-br'}} {{! => Jan 2015}}

Date and Time

{{date-and-time publishedAt}} {{! January 1, 2014 12:00 AM}}
{{date-and-time publishedAt 'pt-br'}} {{! 1 de janeiro de 2014 às 00:00}}

Custom Format

{{time-format updatedAt 'l'}} {{! => 10/9/2014}}

Day of the Week

{{day-of-the-week someDate}} {{! => Friday}}

Locale Support

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'}}

License

MIT

Contributing

  1. Fork it
  2. npm install
  3. bower install
  4. Create your feature branch (git checkout -b my-new-feature)
  5. Commit your changes (git commit -am 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create new Pull Request

Crafted with <3 by John Otander(@4lpine).

ember-cli-dates's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.