0.0.0-alpha.13 • Published 6 years ago

ember-joda v0.0.0-alpha.13

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

ember-joda

Supported Ember versions Build Status Code Climate Coverage npm version Ember Observer Score npm downloads Greenkeeper badge dependencies Status devDependencies Status

:clock2: js-joda — immutable date and time library for Ember.js

Installation

$ ember install ember-joda

Only compatible with Ember 2.12 and onwards. Compatibility with Ember 2.8 LTS is planned.

Usage

js-joda

js-joda is an immutable date and time library for javascript. It provides a simple, domain-driven and clean API based on the ISO8601 calendar.

js-joda is a port of the threeten backport, that is the base for JSR-310 implementation of the Java SE 8 java.time package. Threeten is inspired by Joda-Time, having similar concepts and the same author.

js-joda is robust and stable. We ported more then 1,700 test-cases with lots of test permutations from the threetenbp project. We run the automated karma test-suite against Firefox, Chrome, Node and phantomjs.

Importing js-joda classes

All exports of js-joda are dynamically re-exported as the ember-joda module. This means you can import them like so:

import { LocalDate, YearMonth } from 'ember-joda';

You could also directly access the js-joda module and load the original, unwrapped js-joda classes:

import { LocalDate, YearMonth } from 'js-joda';
// or
import { LocalDate } from 'js-joda/LocalDate';
import { YearMonth } from 'js-joda/YearMonth';

Ember Data Transforms

All js-joda domain models are available as transforms.

// app/models/user.js
import Model from 'ember-data/model';
import attr from 'ember-data/attr';

export default Model.extend({
  birthdate: attr('local-date')
});