Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some improvements #6

Open
wants to merge 5 commits into
base: next
Choose a base branch
from
Open

Some improvements #6

wants to merge 5 commits into from

Conversation

mastropinguino
Copy link

Hello,
I'm using this library and I made some changes to library for my needs.
In this PR you will find these changes:

  1. Added support for multiple locale loading. I needs to load all/some locales and switch between at runtime.
  2. Added support to switch between locale at runtime (globally or on instance). Eg.
// require('globalization/en-US');
// require('globalization/it-IT');
// Set global date locale to en-US, this call will set Data.CultureInfo also.
// When no default locale is set, Data.CultureInfo will be same of first locale file loaded.
// In this way my changes are backward compatible.
Date.setLocale('en-US');

var d1 = new Date(2013, 0, 1);
var d2 = new Date(2013, 0, 1);
console.debug(d1.toString('m')); // => "January 01"
console.debug(d2.toString('m')); // => "January 01"

d2.setLocale('it-IT');
console.debug(d1.toString('m')); // => "January 01"
console.debug(d2.toString('m')); // => "01 gennaio"
  1. Updated nodeunit to latest version which run on nodejs v0.10.3

I hope my work could be useful.

* Removed static reference to  = Date.CultureInfo, now current CultureInfo is guessed at runtime and can be changed
* Added support to change locale for global Data object and every instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant