aishek / js-countdown

Javascript countdown ready-to-use solution with pluralization in English and Russian languages

Home Page:http://aishek.github.io/js-countdown/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

js-countdown

Demo | Latest Release v0.0.2

Javascript countdown ready-to-use solution with pluralization in English and Russian languages.

Quick example

<p style="text-align: center;">Until year 2038 problem remains<br><span id="output_target"></span></p>
var output_target = document.getElementById('countdown'),
    label_builder = Countdown.Helper.Pluralize.label_builder_factory('en'),
    countdown = new Countdown(
      {
        progress: function(seconds) {
          output_target.innerHTML = label_builder(seconds);
        },
        complete: function() {
          output_target.innerHTML = 'Meet "Year 2038 problem"!';
        }
      }
    );

var date_2038_problem = Date.UTC(2038, 1, 19, 3, 14, 7),
    seconds_from_epoch_to_date_2038_problem = Math.floor(date_2038_problem / 1000);

countdown.start_to(seconds_from_epoch_to_date_2038_problem);

All examples

Features

  • count to specified date and from specified date or from now
  • built-in, extensible to any language text frontend with pluralization for English and Russian languages
  • built-in, extensible counter for days, hours, minutes and seconds from passed or elapsed seconds
  • design simplicity, extendability and modularity
  • lightweight (about 3Kb minified)

Alternative plugins for same task

Development

  1. npm install grunt-cli -g
  2. npm install
  3. https://github.com/gmarty/grunt-closure-compiler
  4. grunt watch

Note on Patches / Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Send me a pull request. Bonus points for topic branches.

License

It is free software, and may be redistributed under the terms specified in the LICENSE file.

Credits

Contributors:

About

Javascript countdown ready-to-use solution with pluralization in English and Russian languages

http://aishek.github.io/js-countdown/

License:MIT License


Languages

Language:JavaScript 100.0%