Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Requires the most current version of Chrome Canary
- *
- * Demonstrates out of:
- *
- * v8Intl.DateTimeFormat([ locale ], options ).format()
- *
- *
- */
- var locales, dtfProps;
- locales = [
- "en",
- "de",
- "es",
- "jp",
- "ar",
- "fr",
- "ko"
- ];
- dtfProps = {
- weekday: [ "narrow", "short", "long" ],
- era: [ "narrow", "short", "long" ],
- year: [ "2-digit", "numeric" ],
- month: [ "2-digit", "numeric", "narrow", "short", "long" ],
- day: [ "2-digit", "numeric" ],
- hour: [ "2-digit", "numeric" ],
- minute: [ "2-digit", "numeric" ],
- second: [ "2-digit", "numeric" ],
- timeZoneName: [ "short", "long" ]
- };
- locales.forEach(function( locale ) {
- console.group( locale );
- Object.keys( dtfProps ).forEach(function( prop ) {
- var allowables = this[ prop ];
- console.group( "\t" + prop );
- allowables.forEach(function( allow ) {
- var options = {};
- options[ prop ] = allow;
- console.log( "\t\t" + allow + ": " +
- v8Intl.DateTimeFormat([ locale ], options ).format()
- );
- });
- console.groupEnd( "\t" + prop );
- }, dtfProps );
- console.groupEnd( locale );
- });
Add Comment
Please, Sign In to add comment