Skip to content

andyklimczak/ember-countdown

Repository files navigation

ember-countdown

Build Status

Ember-cli addon for countdownjs, and allowing countdownjs to be consumed as an ES6 module in your ember application.

ember install ember-countdown
import countdown from 'countdownjs';

As a component:

{{countdown-string startDate='11/24/1992 17:56:53 GMT'}}

=> 25 years, 6 months, 18 days, 7 hours, 43 minutes and 35 seconds

{{countdown-html startDate='1992/11/24'}}

=> <span>25 years</span>, <span>6 months</span>, <span>18 days</span>, <span>7 hours</span>, <span>43 minutes</span> and <span>57 seconds</span>

To create a countdown that only has months and days, create a new component in your project that extends the components from this addon:

import countdown from 'countdownjs';
import CountdownString from 'ember-countdown/components/countdown-string';

export default CountdownString.extend({
  units: countdown.MONTHS|countdown.DAYS
});

Other values can be overriden as well:

import countdown from 'countdownjs';
import CountdownHTML from 'ember-countdown/components/countdown-html';

export default CountdownHTML.extend({
  htmlTag: 'b',
  units: countdown.SECONDS
});

WARNING: If you use ember generate component my-countdown, make sure to delete the generated template file components/my-countdown.hbs or nothing will appear.

Further usage examples for the two components with all optional parameters explored can be seen in the integration tests and the addon's dummy app. Explanation of the parameters is documented in the countdownjs readme.

Development Installation

  • git clone this repository
  • npm install

Running

Running Tests

  • npm test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.