Skip to content
DateJS: Evolved. An updated, bug fixed, and actively maintained continuation of DateJS
Branch: master
Clone or download
Gregory Wild-Smith
Gregory Wild-Smith Merge pull request #262 from keheliya/master
Refactoring install commands into install phase
Latest commit 3675d46 Mar 6, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
build Updating Build versions to include recent bug fixes Mar 23, 2015
reports updating how reports are generated Nov 16, 2014
specs fixes #239 - corrected test comparison Jan 13, 2016
src Merge branch 'master' of Jan 13, 2016
.gitignore updating ignore files Jan 6, 2014
.jshintrc adding jshint config settings for project Apr 3, 2014
.npmignore updating npm ignore info Jan 6, 2014
GruntFile.js Updating Build Files with latest code Dec 16, 2014
LICENSE Initial commit of DateJS code Aug 23, 2013 Update Jasmine link Oct 24, 2016
bower.json updating Bower config Jun 10, 2014
index.js adding new file into index for node libs Nov 14, 2014
package.json Updating Build Files with latest code Dec 16, 2014

DateJS: Evolved

The JavaScript Date Library
Build Status NPM version Code Climate Test Coverage

What is it?

DateJS extends the built-in JavaScript Date object to add much better parsing, internationalization support, and all the functions and syntactic sugar you could wish for.


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.

This fork was started improve and maintain DateJS. To keep what is still the most full featured JavaScript Date library alive, maintained, and improved. Currently we're on track towards a 1.0 release - having fixed almost all the existing bugs and added several new features, improved parsing, and many other changes.

How to Install/Use

DateJS supports running either your regular web browser as a client library or Node.js.

In 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


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.

In Node.js

Just call the following: Date.i18n.setLanguage([country code]) 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:

  1. Set Date.Config.i18n to 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.
  2. 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.js loads 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.

File Structure

  • 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.
  • src All 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 lcov and html that are generated by Istanbul
  • tests/ Orginal unit tests for 2008 project. Deprecated
You can’t perform that action at this time.