Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abritinthebay/datejs
DateJS: Evolved. An updated, bug fixed, and actively maintained continuation of DateJS
https://github.com/abritinthebay/datejs
Last synced: 9 days ago
JSON representation
DateJS: Evolved. An updated, bug fixed, and actively maintained continuation of DateJS
- Host: GitHub
- URL: https://github.com/abritinthebay/datejs
- Owner: abritinthebay
- License: other
- Created: 2013-08-22T17:38:45.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-01-09T05:21:50.000Z (almost 2 years ago)
- Last Synced: 2024-10-29T20:56:02.413Z (14 days ago)
- Language: JavaScript
- Homepage:
- Size: 8.55 MB
- Stars: 354
- Watchers: 25
- Forks: 79
- Open Issues: 38
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DateJS: Evolved
The JavaScript Date Library
[![Build Status](https://travis-ci.org/abritinthebay/datejs.svg?branch=master)](https://travis-ci.org/abritinthebay/datejs)
[![NPM version](https://badge.fury.io/js/datejs.svg)](http://badge.fury.io/js/datejs)
[![Code Climate](https://codeclimate.com/github/abritinthebay/datejs.svg)](https://codeclimate.com/github/abritinthebay/datejs)
[![Test Coverage](https://codeclimate.com/github/abritinthebay/datejs/badges/coverage.svg)](https://codeclimate.com/github/abritinthebay/datejs)## 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.
### Background
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](http://bower.io/) to manage your frontend packages then it's also really simple:bower install datejs
Otherwise...
* For production environments include [the production ready minified file from the Build directory](https://github.com/abritinthebay/datejs/blob/master/build/production/date.min.js) on your page.
* For debugging (eg, in development) include [the unminified and fully commented version](https://github.com/abritinthebay/datejs/blob/master/build/date.js)#### 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](https://github.com/abritinthebay/datejs/blob/master/build/i18n/) 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](https://github.com/abritinthebay/datejs/blob/master/build/). 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](https://jasmine.github.io/). Code coverage is calculated by [BlanketJS](http://blanketjs.org/).
* `reports/` Code coverage reports in `lcov` and `html` that are generated by [Istanbul](http://gotwarlost.github.io/istanbul/)
* `tests/` Orginal unit tests for 2008 project. *Deprecated*