js-countdown
js-countdown copied to clipboard
Javascript countdown ready-to-use solution with pluralization in English and Russian languages
js-countdown
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);
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
-
npm install grunt-cli -g
-
npm install
-
https://github.com/gmarty/grunt-closure-compiler
-
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: