What is it?
Date JS was started by Geoffrey McGill in 2007, he abandoned it on May 13th 2008; leaving the Google Code repository stagnant and with many bugs unresolved.
How to Install/Use
DateJS supports running either your regular web browser as a client library or Node.js.
Installation is as easy as running:
npm install datejs
To run just
require('datejs') and DateJS will extend the built in Date object like it does in the browser.
For a Browser
If you use Bower to manage your frontend packages then it's also really simple:
bower install datejs
- For production environments include the production ready minified file from the Build directory on your page.
- For debugging (eg, in development) include the unminified and fully commented version
International Language Versions
DateJS supports 157 different languages and dialects and ships with US English as the default. It is however easily changed and you can support languages on the fly or just a specific subset.
Just call the following:
Where "country code" is the appropriate IETF code for the language (e.g. "de-DE", or "es-MX") and DateJS will import the correct strings for that language.
In a Browser
For browsers DateJS has langauge support in one of two ways:
Date.Config.i18nto the location of the internationalization files on your server and DateJS will dynamically load the files by dynamic script element insertion. You can support all languages this way.
- Or download the appropriate file from the Build directory of your choice. Files are named after the IETF code the load (i.e.
date-es-MX.jsloads Mexican Spanish). This static method will only allow you support of the selected language & US English.
DateJS +will always support loading US English_ via
Date.i18n.setLanguage("en-US") no matter what other language is specifically loaded. So you can always support both your localization and the English speaking world.
build/Output from the Grunt powered build process
- Non-minified files with full comments. Suitable for development environments.
production/Fully minified (by Google's Closure Compiler) files suitable for production.
srcAll the source files used to build the final files.
core/The main DateJS source files.
i18n/Internationalization files. Language specifics (days of the week, regex formats,etc). Organized by IETF language tag (eg - en-US, etc).
specs/Unit Tests written using Jasmine. Code coverage is calculated by BlanketJS.
reports/Code coverage reports in
htmlthat are generated by Istanbul
tests/Orginal unit tests for 2008 project. Deprecated