Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

XDate: Changing the Locale

View xdate_changing_locale.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// You can add new locales by adding a new object to the `XDate.locales` hash.
// You can change the default locale by changing `XDate.defaultLocale`.
 
XDate.locales['fr'] = {
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin','Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.']
};
 
new XDate().toString('d MMMM, yyyy', 'fr'); // "24 Octobre, 2011"
 
// or, you set the default locale...
XDate.defaultLocale = 'fr';
new XDate().toString('d MMMM, yyyy'); // "24 Octobre, 2011"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.