Comparing version 1.3.0-alpha.1 to 1.3.0-alpha.2
/** | ||
* Globalize Runtime v1.3.0-alpha.1 | ||
* Globalize Runtime v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize Runtime v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -19,2 +19,4 @@ */ | ||
"use strict"; | ||
// UMD returnExports | ||
@@ -37,2 +39,4 @@ if ( typeof define === "function" && define.amd ) { | ||
/** | ||
@@ -39,0 +43,0 @@ * A toString method that outputs meaningful values for objects or arrays and |
/** | ||
* Globalize Runtime v1.3.0-alpha.1 | ||
* Globalize Runtime v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize Runtime v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -19,2 +19,4 @@ */ | ||
"use strict"; | ||
// UMD returnExports | ||
@@ -42,2 +44,4 @@ if ( typeof define === "function" && define.amd ) { | ||
var formatMessage = Globalize._formatMessage, | ||
@@ -44,0 +48,0 @@ runtimeKey = Globalize._runtimeKey, |
/** | ||
* Globalize Runtime v1.3.0-alpha.1 | ||
* Globalize Runtime v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize Runtime v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -19,2 +19,4 @@ */ | ||
"use strict"; | ||
// UMD returnExports | ||
@@ -42,2 +44,4 @@ if ( typeof define === "function" && define.amd ) { | ||
var createErrorUnsupportedFeature = Globalize._createErrorUnsupportedFeature, | ||
@@ -103,3 +107,3 @@ regexpEscape = Globalize._regexpEscape, | ||
var dateStartOf = function( date, unit ) { | ||
date = date.isGlobalizeDate ? date.clone() : new Date( date.getTime() ); | ||
date = new Date( date.getTime() ); | ||
switch ( unit ) { | ||
@@ -171,3 +175,3 @@ case "year": | ||
"second": "sSA", | ||
"zone": "zvVOxX" | ||
"zone": "zOxX" | ||
}, function( object, key, value ) { | ||
@@ -248,147 +252,4 @@ value.split( "" ).forEach(function( symbol ) { | ||
var GlobalizeDate = (function() { | ||
function getUntilsIndex( original, untils ) { | ||
var index = 0, | ||
originalTime = original.getTime(); | ||
// TODO Should we do binary search for improved performance? | ||
while ( index < untils.length - 1 && originalTime >= untils[ index ] ) { | ||
index++; | ||
} | ||
return index; | ||
} | ||
var GlobalizeDate = function( date, timeZoneData ) { | ||
this.original = new Date( date.getTime() ); | ||
this.local = new Date( date.getTime() ); | ||
this.isGlobalizeDate = true; | ||
this.timeZoneData = timeZoneData; | ||
if ( !( timeZoneData.untils && timeZoneData.offsets && timeZoneData.isdsts ) ) { | ||
throw new Error( "Invalid IANA data" ); | ||
} | ||
this.setTime( this.local.getTime() - this.getTimezoneOffset() * 60 * 1000 ); | ||
}; | ||
GlobalizeDate.prototype.setWrap = function( fn ) { | ||
var offset1 = this.getTimezoneOffset(); | ||
var ret = fn(); | ||
this.original = new Date( this.getTime() ); | ||
var offset2 = this.getTimezoneOffset(); | ||
this.original.setMinutes( this.original.getMinutes() + offset2 - offset1 ); | ||
return ret; | ||
}; | ||
GlobalizeDate.prototype.clone = function() { | ||
return new GlobalizeDate( this.original, this.timeZoneData ); | ||
}; | ||
GlobalizeDate.prototype.getFullYear = function() { | ||
return this.local.getUTCFullYear(); | ||
}; | ||
GlobalizeDate.prototype.getMonth = function() { | ||
return this.local.getUTCMonth(); | ||
}; | ||
GlobalizeDate.prototype.getDate = function() { | ||
return this.local.getUTCDate(); | ||
}; | ||
GlobalizeDate.prototype.getDay = function() { | ||
return this.local.getUTCDay(); | ||
}; | ||
GlobalizeDate.prototype.getHours = function() { | ||
return this.local.getUTCHours(); | ||
}; | ||
GlobalizeDate.prototype.getMinutes = function() { | ||
return this.local.getUTCMinutes(); | ||
}; | ||
GlobalizeDate.prototype.getSeconds = function() { | ||
return this.local.getUTCSeconds(); | ||
}; | ||
GlobalizeDate.prototype.getMilliseconds = function() { | ||
return this.local.getUTCMilliseconds(); | ||
}; | ||
GlobalizeDate.prototype.getTime = function() { | ||
return this.local.getTime() + this.getTimezoneOffset() * 60 * 1000; | ||
}; | ||
GlobalizeDate.prototype.getTimezoneOffset = function() { | ||
var index = getUntilsIndex( this.original, this.timeZoneData.untils ); | ||
return this.timeZoneData.offsets[ index ]; | ||
}; | ||
GlobalizeDate.prototype.setFullYear = function( year ) { | ||
var local = this.local; | ||
return this.setWrap(function() { | ||
return local.setUTCFullYear( year ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setMonth = function( month ) { | ||
var local = this.local; | ||
return this.setWrap(function() { | ||
return local.setUTCMonth( month ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setDate = function( date ) { | ||
var local = this.local; | ||
return this.setWrap(function() { | ||
return local.setUTCDate( date ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setHours = function( hour ) { | ||
var local = this.local; | ||
return this.setWrap(function() { | ||
return local.setUTCHours( hour ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setMinutes = function( minutes ) { | ||
var local = this.local; | ||
return this.setWrap(function() { | ||
return local.setUTCMinutes( minutes ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setSeconds = function( seconds ) { | ||
var local = this.local; | ||
// setWrap is needed here just because abs(seconds) could be >= a minute. | ||
return this.setWrap(function() { | ||
return local.setUTCSeconds( seconds ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setMilliseconds = function( milliseconds ) { | ||
var local = this.local; | ||
// setWrap is needed here just because abs(seconds) could be >= a minute. | ||
return this.setWrap(function() { | ||
return local.setUTCMilliseconds( milliseconds ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setTime = function( time ) { | ||
return this.local.setTime( time ); | ||
}; | ||
GlobalizeDate.prototype.isDST = function() { | ||
var index = getUntilsIndex( this.original, this.timeZoneData.untils ); | ||
return Boolean( this.timeZoneData.isdsts[ index ] ); | ||
}; | ||
return GlobalizeDate; | ||
}()); | ||
/** | ||
@@ -410,7 +271,2 @@ * format( date, properties ) | ||
// create globalize date with given timezone data | ||
if ( properties.timeZoneData ) { | ||
date = new GlobalizeDate( date, properties.timeZoneData ); | ||
} | ||
properties.pattern.replace( datePatternRe, function( current ) { | ||
@@ -447,19 +303,2 @@ var dateField, type, value, | ||
// z...zzz: "{shortRegion}", e.g., "PST" or "PDT". | ||
// zzzz: "{regionName} {Standard Time}" or "{regionName} {Daylight Time}", | ||
// e.g., "Pacific Standard Time" or "Pacific Daylight Time". | ||
if ( chr === "z" ) { | ||
if ( date.isDST ) { | ||
value = date.isDST() ? properties.daylightTzName : properties.standardTzName; | ||
} | ||
// Fall back to "O" format. | ||
if ( !value ) { | ||
chr = "O"; | ||
if ( length < 4 ) { | ||
length = 1; | ||
} | ||
} | ||
} | ||
switch ( chr ) { | ||
@@ -617,24 +456,2 @@ | ||
case "z": | ||
break; | ||
case "v": | ||
// v...vvv: "{shortRegion}", eg. "PT". | ||
// vvvv: "{regionName} {Time}", | ||
// e.g., "Pacific Time". | ||
if ( properties.genericTzName ) { | ||
value = properties.genericTzName; | ||
break; | ||
} | ||
/* falls through */ | ||
case "V": | ||
//VVVV: "{explarCity} {Time}", e.g., "Los Angeles Time" | ||
if ( properties.timeZoneName ) { | ||
value = properties.timeZoneName; | ||
break; | ||
} | ||
/* falls through */ | ||
case "O": | ||
@@ -808,7 +625,2 @@ | ||
// Create globalize date with given timezone data. | ||
if ( properties.timeZoneData ) { | ||
date = new GlobalizeDate( date, properties.timeZoneData ); | ||
} | ||
if ( !tokens.length ) { | ||
@@ -1062,7 +874,2 @@ return null; | ||
// Get date back from globalize date. | ||
if ( date.isGlobalizeDate ) { | ||
date = new Date( date.getTime() ); // FIXME can we improve this? E.g., toDate() | ||
} | ||
return date; | ||
@@ -1558,10 +1365,2 @@ }; | ||
function optionsHasStyle( options ) { | ||
return options.skeleton !== undefined || | ||
options.date !== undefined || | ||
options.time !== undefined || | ||
options.datetime !== undefined || | ||
options.raw !== undefined; | ||
} | ||
Globalize.dateFormatter = | ||
@@ -1580,6 +1379,3 @@ Globalize.prototype.dateFormatter = function( options ) { | ||
Globalize.prototype.dateToPartsFormatter = function( options ) { | ||
options = options || {}; | ||
if ( !optionsHasStyle( options ) ) { | ||
options.skeleton = "yMd"; | ||
} | ||
options = options || { skeleton: "yMd" }; | ||
return Globalize[ runtimeKey( "dateToPartsFormatter", this._locale, [ options ] ) ]; | ||
@@ -1590,6 +1386,3 @@ }; | ||
Globalize.prototype.dateParser = function( options ) { | ||
options = options || {}; | ||
if ( !optionsHasStyle( options ) ) { | ||
options.skeleton = "yMd"; | ||
} | ||
options = options || { skeleton: "yMd" }; | ||
return Globalize[ runtimeKey( "dateParser", this._locale, [ options ] ) ]; | ||
@@ -1596,0 +1389,0 @@ }; |
/** | ||
* Globalize Runtime v1.3.0-alpha.1 | ||
* Globalize Runtime v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize Runtime v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -19,2 +19,4 @@ */ | ||
"use strict"; | ||
// UMD returnExports | ||
@@ -38,2 +40,4 @@ if ( typeof define === "function" && define.amd ) { | ||
var runtimeKey = Globalize._runtimeKey, | ||
@@ -40,0 +44,0 @@ validateParameterType = Globalize._validateParameterType; |
/** | ||
* Globalize Runtime v1.3.0-alpha.1 | ||
* Globalize Runtime v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize Runtime v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -19,2 +19,4 @@ */ | ||
"use strict"; | ||
// UMD returnExports | ||
@@ -38,2 +40,4 @@ if ( typeof define === "function" && define.amd ) { | ||
var createError = Globalize._createError, | ||
@@ -40,0 +44,0 @@ regexpEscape = Globalize._regexpEscape, |
/** | ||
* Globalize Runtime v1.3.0-alpha.1 | ||
* Globalize Runtime v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize Runtime v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -19,2 +19,4 @@ */ | ||
"use strict"; | ||
// UMD returnExports | ||
@@ -38,2 +40,4 @@ if ( typeof define === "function" && define.amd ) { | ||
var runtimeKey = Globalize._runtimeKey, | ||
@@ -40,0 +44,0 @@ validateParameterPresence = Globalize._validateParameterPresence, |
/** | ||
* Globalize Runtime v1.3.0-alpha.1 | ||
* Globalize Runtime v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize Runtime v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -19,2 +19,4 @@ */ | ||
"use strict"; | ||
// UMD returnExports | ||
@@ -44,2 +46,4 @@ if ( typeof define === "function" && define.amd ) { | ||
var formatMessage = Globalize._formatMessage, | ||
@@ -46,0 +50,0 @@ runtimeKey = Globalize._runtimeKey, |
/** | ||
* Globalize Runtime v1.3.0-alpha.1 | ||
* Globalize Runtime v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize Runtime v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize Runtime v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -19,2 +19,4 @@ */ | ||
"use strict"; | ||
// UMD returnExports | ||
@@ -44,2 +46,4 @@ if ( typeof define === "function" && define.amd ) { | ||
var formatMessage = Globalize._formatMessage, | ||
@@ -46,0 +50,0 @@ runtimeKey = Globalize._runtimeKey, |
/** | ||
* Globalize v1.3.0-alpha.1 | ||
* Globalize v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/*! | ||
* Globalize v1.3.0-alpha.1 | ||
* Globalize v1.3.0-alpha.2 | ||
* | ||
@@ -10,3 +10,3 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
@@ -13,0 +13,0 @@ (function( root, factory ) { |
/** | ||
* Globalize v1.3.0-alpha.1 | ||
* Globalize v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -415,3 +415,3 @@ */ | ||
var dateStartOf = function( date, unit ) { | ||
date = date.isGlobalizeDate ? date.clone() : new Date( date.getTime() ); | ||
date = new Date( date.getTime() ); | ||
switch ( unit ) { | ||
@@ -467,3 +467,3 @@ case "year": | ||
"second": "sSA", | ||
"zone": "zvVOxX" | ||
"zone": "zOxX" | ||
}, function( object, key, value ) { | ||
@@ -539,147 +539,4 @@ value.split( "" ).forEach(function( symbol ) { | ||
var GlobalizeDate = (function() { | ||
function getUntilsIndex( original, untils ) { | ||
var index = 0, | ||
originalTime = original.getTime(); | ||
// TODO Should we do binary search for improved performance? | ||
while ( index < untils.length - 1 && originalTime >= untils[ index ] ) { | ||
index++; | ||
} | ||
return index; | ||
} | ||
var GlobalizeDate = function( date, timeZoneData ) { | ||
this.original = new Date( date.getTime() ); | ||
this.local = new Date( date.getTime() ); | ||
this.isGlobalizeDate = true; | ||
this.timeZoneData = timeZoneData; | ||
if ( !( timeZoneData.untils && timeZoneData.offsets && timeZoneData.isdsts ) ) { | ||
throw new Error( "Invalid IANA data" ); | ||
} | ||
this.setTime( this.local.getTime() - this.getTimezoneOffset() * 60 * 1000 ); | ||
}; | ||
GlobalizeDate.prototype.setWrap = function( fn ) { | ||
var offset1 = this.getTimezoneOffset(); | ||
var ret = fn(); | ||
this.original = new Date( this.getTime() ); | ||
var offset2 = this.getTimezoneOffset(); | ||
this.original.setMinutes( this.original.getMinutes() + offset2 - offset1 ); | ||
return ret; | ||
}; | ||
GlobalizeDate.prototype.clone = function() { | ||
return new GlobalizeDate( this.original, this.timeZoneData ); | ||
}; | ||
GlobalizeDate.prototype.getFullYear = function() { | ||
return this.local.getUTCFullYear(); | ||
}; | ||
GlobalizeDate.prototype.getMonth = function() { | ||
return this.local.getUTCMonth(); | ||
}; | ||
GlobalizeDate.prototype.getDate = function() { | ||
return this.local.getUTCDate(); | ||
}; | ||
GlobalizeDate.prototype.getDay = function() { | ||
return this.local.getUTCDay(); | ||
}; | ||
GlobalizeDate.prototype.getHours = function() { | ||
return this.local.getUTCHours(); | ||
}; | ||
GlobalizeDate.prototype.getMinutes = function() { | ||
return this.local.getUTCMinutes(); | ||
}; | ||
GlobalizeDate.prototype.getSeconds = function() { | ||
return this.local.getUTCSeconds(); | ||
}; | ||
GlobalizeDate.prototype.getMilliseconds = function() { | ||
return this.local.getUTCMilliseconds(); | ||
}; | ||
GlobalizeDate.prototype.getTime = function() { | ||
return this.local.getTime() + this.getTimezoneOffset() * 60 * 1000; | ||
}; | ||
GlobalizeDate.prototype.getTimezoneOffset = function() { | ||
var index = getUntilsIndex( this.original, this.timeZoneData.untils ); | ||
return this.timeZoneData.offsets[ index ]; | ||
}; | ||
GlobalizeDate.prototype.setFullYear = function( year ) { | ||
var local = this.local; | ||
return this.setWrap(function() { | ||
return local.setUTCFullYear( year ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setMonth = function( month ) { | ||
var local = this.local; | ||
return this.setWrap(function() { | ||
return local.setUTCMonth( month ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setDate = function( date ) { | ||
var local = this.local; | ||
return this.setWrap(function() { | ||
return local.setUTCDate( date ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setHours = function( hour ) { | ||
var local = this.local; | ||
return this.setWrap(function() { | ||
return local.setUTCHours( hour ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setMinutes = function( minutes ) { | ||
var local = this.local; | ||
return this.setWrap(function() { | ||
return local.setUTCMinutes( minutes ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setSeconds = function( seconds ) { | ||
var local = this.local; | ||
// setWrap is needed here just because abs(seconds) could be >= a minute. | ||
return this.setWrap(function() { | ||
return local.setUTCSeconds( seconds ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setMilliseconds = function( milliseconds ) { | ||
var local = this.local; | ||
// setWrap is needed here just because abs(seconds) could be >= a minute. | ||
return this.setWrap(function() { | ||
return local.setUTCMilliseconds( milliseconds ); | ||
}); | ||
}; | ||
GlobalizeDate.prototype.setTime = function( time ) { | ||
return this.local.setTime( time ); | ||
}; | ||
GlobalizeDate.prototype.isDST = function() { | ||
var index = getUntilsIndex( this.original, this.timeZoneData.untils ); | ||
return Boolean( this.timeZoneData.isdsts[ index ] ); | ||
}; | ||
return GlobalizeDate; | ||
}()); | ||
/** | ||
@@ -701,7 +558,2 @@ * format( date, properties ) | ||
// create globalize date with given timezone data | ||
if ( properties.timeZoneData ) { | ||
date = new GlobalizeDate( date, properties.timeZoneData ); | ||
} | ||
properties.pattern.replace( datePatternRe, function( current ) { | ||
@@ -738,19 +590,2 @@ var dateField, type, value, | ||
// z...zzz: "{shortRegion}", e.g., "PST" or "PDT". | ||
// zzzz: "{regionName} {Standard Time}" or "{regionName} {Daylight Time}", | ||
// e.g., "Pacific Standard Time" or "Pacific Daylight Time". | ||
if ( chr === "z" ) { | ||
if ( date.isDST ) { | ||
value = date.isDST() ? properties.daylightTzName : properties.standardTzName; | ||
} | ||
// Fall back to "O" format. | ||
if ( !value ) { | ||
chr = "O"; | ||
if ( length < 4 ) { | ||
length = 1; | ||
} | ||
} | ||
} | ||
switch ( chr ) { | ||
@@ -908,24 +743,2 @@ | ||
case "z": | ||
break; | ||
case "v": | ||
// v...vvv: "{shortRegion}", eg. "PT". | ||
// vvvv: "{regionName} {Time}", | ||
// e.g., "Pacific Time". | ||
if ( properties.genericTzName ) { | ||
value = properties.genericTzName; | ||
break; | ||
} | ||
/* falls through */ | ||
case "V": | ||
//VVVV: "{explarCity} {Time}", e.g., "Los Angeles Time" | ||
if ( properties.timeZoneName ) { | ||
value = properties.timeZoneName; | ||
break; | ||
} | ||
/* falls through */ | ||
case "O": | ||
@@ -1041,3 +854,3 @@ | ||
*/ | ||
var dateFormatProperties = function( pattern, cldr, timeZone ) { | ||
var dateFormatProperties = function( pattern, cldr ) { | ||
var properties = { | ||
@@ -1050,31 +863,2 @@ numberFormatters: {}, | ||
function getTimeZoneName( length, type ) { | ||
var metaZone, result; | ||
result = cldr.main([ | ||
"dates/timeZoneNames/zone", | ||
timeZone, | ||
length < 4 ? "short" : "long", | ||
type | ||
]); | ||
if ( result ) { | ||
return result; | ||
} | ||
// The latest metazone data of the metazone array. | ||
// TODO expand to support the historic metazones based on the given date. | ||
metaZone = cldr.supplemental([ | ||
"metaZones/metazoneInfo/timezone", timeZone, 0, | ||
"usesMetazone/_mzone" | ||
]); | ||
return cldr.main([ | ||
"dates/timeZoneNames/metazone", | ||
metaZone, | ||
length < 4 ? "short" : "long", | ||
type | ||
]); | ||
} | ||
function setNumberFormatterPattern( pad ) { | ||
@@ -1084,17 +868,6 @@ properties.numberFormatters[ pad ] = stringPad( "", pad ); | ||
if ( timeZone ) { | ||
properties.timeZoneData = { | ||
offsets: cldr.get([ "globalize-iana/zoneData", timeZone, "offsets" ]), | ||
untils: cldr.get([ "globalize-iana/zoneData", timeZone, "untils" ]), | ||
isdsts: cldr.get([ "globalize-iana/zoneData", timeZone, "isdsts" ]) | ||
}; | ||
} | ||
pattern.replace( datePatternRe, function( current ) { | ||
var formatNumber, | ||
chr = current.charAt( 0 ), | ||
length = current.length, | ||
standardTzName, | ||
daylightTzName, | ||
genericTzName; | ||
length = current.length; | ||
@@ -1114,39 +887,2 @@ if ( chr === "j" ) { | ||
// z...zzz: "{shortRegion}", eg. "PST" or "PDT". | ||
// zzzz: "{regionName} {Standard Time}" or "{regionName} {Daylight Time}", | ||
// e.g., "Pacific Standard Time" or "Pacific Daylight Time". | ||
// http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns | ||
if ( chr === "z" ) { | ||
standardTzName = getTimeZoneName( length, "standard" ); | ||
daylightTzName = getTimeZoneName( length, "daylight" ); | ||
if ( standardTzName ) { | ||
properties.standardTzName = standardTzName; | ||
} | ||
if ( daylightTzName ) { | ||
properties.daylightTzName = daylightTzName; | ||
} | ||
// Fall through the "O" format in case one name is missing. | ||
if ( !standardTzName || !daylightTzName ) { | ||
chr = "O"; | ||
if ( length < 4 ) { | ||
length = 1; | ||
} | ||
} | ||
} | ||
// v...vvv: "{shortRegion}", eg. "PT". | ||
// vvvv: "{regionName} {Time}" or "{regionName} {Time}", | ||
// e.g., "Pacific Time" | ||
// http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns | ||
if ( chr === "v" ) { | ||
genericTzName = getTimeZoneName( length, "generic" ); | ||
// Fall back to "V" format. | ||
if ( !genericTzName ) { | ||
chr = "V"; | ||
length = 4; | ||
} | ||
} | ||
switch ( chr ) { | ||
@@ -1315,54 +1051,3 @@ | ||
// Zone | ||
case "v": | ||
if ( length !== 1 && length !== 4 ) { | ||
throw createErrorUnsupportedFeature({ | ||
feature: "timezone pattern `" + pattern + "`" | ||
}); | ||
} | ||
properties.genericTzName = genericTzName; | ||
break; | ||
case "V": | ||
if ( length === 1 ) { | ||
throw createErrorUnsupportedFeature({ | ||
feature: "timezone pattern `" + pattern + "`" | ||
}); | ||
} | ||
if ( timeZone ) { | ||
var timeZoneName; | ||
if ( length === 2 ) { | ||
timeZoneName = timeZone; | ||
} | ||
var exemplarCity = cldr.main([ | ||
"dates/timeZoneNames/zone", timeZone, "exemplarCity" | ||
]); | ||
if ( length === 3 ) { | ||
if ( !exemplarCity ) { | ||
exemplarCity = cldr.main([ | ||
"dates/timeZoneNames/zone/Etc/Unknown/exemplarCity" | ||
]); | ||
} | ||
timeZoneName = exemplarCity; | ||
} | ||
if ( exemplarCity && length === 4 ) { | ||
timeZoneName = formatMessage( | ||
cldr.main( | ||
"dates/timeZoneNames/regionFormat" | ||
), | ||
[ exemplarCity ] | ||
); | ||
} | ||
if ( timeZoneName ) { | ||
properties.timeZoneName = timeZoneName; | ||
break; | ||
} | ||
} | ||
/* falls through */ | ||
case "z": | ||
case "O": | ||
@@ -1383,2 +1068,8 @@ | ||
break; | ||
case "v": | ||
case "V": | ||
throw createErrorUnsupportedFeature({ | ||
feature: "timezone pattern `" + chr + "`" | ||
}); | ||
} | ||
@@ -1490,7 +1181,2 @@ | ||
// Create globalize date with given timezone data. | ||
if ( properties.timeZoneData ) { | ||
date = new GlobalizeDate( date, properties.timeZoneData ); | ||
} | ||
if ( !tokens.length ) { | ||
@@ -1744,7 +1430,2 @@ return null; | ||
// Get date back from globalize date. | ||
if ( date.isGlobalizeDate ) { | ||
date = new Date( date.getTime() ); // FIXME can we improve this? E.g., toDate() | ||
} | ||
return date; | ||
@@ -2225,20 +1906,8 @@ }; | ||
* | ||
* @timeZone [String] FIXME. | ||
* | ||
* Return parser properties. | ||
*/ | ||
var dateParseProperties = function( cldr, timeZone ) { | ||
var properties = { | ||
var dateParseProperties = function( cldr ) { | ||
return { | ||
preferredTimeData: cldr.supplemental.timeData.preferred() | ||
}; | ||
if ( timeZone ) { | ||
properties.timeZoneData = { | ||
offsets: cldr.get([ "globalize-iana/zoneData", timeZone, "offsets" ]), | ||
untils: cldr.get([ "globalize-iana/zoneData", timeZone, "untils" ]), | ||
isdsts: cldr.get([ "globalize-iana/zoneData", timeZone, "isdsts" ]) | ||
}; | ||
} | ||
return properties; | ||
}; | ||
@@ -2420,10 +2089,2 @@ | ||
function optionsHasStyle( options ) { | ||
return options.skeleton !== undefined || | ||
options.date !== undefined || | ||
options.time !== undefined || | ||
options.datetime !== undefined || | ||
options.raw !== undefined; | ||
} | ||
function validateRequiredCldr( path, value ) { | ||
@@ -2434,6 +2095,2 @@ validateCldr( path, value, { | ||
/dates\/calendars\/gregorian\/days\/.*\/short/, | ||
/dates\/timeZoneNames\/zone/, | ||
/dates\/timeZoneNames\/metazone/, | ||
/globalize-iana/, | ||
/supplemental\/metaZones/, | ||
/supplemental\/timeData\/(?!001)/, | ||
@@ -2470,40 +2127,3 @@ /supplemental\/weekData\/(?!001)/ | ||
function validateRequiredIana( timeZone ) { | ||
return function( path, value ) { | ||
if ( !/globalize-iana/.test( path ) ) { | ||
return; | ||
} | ||
validate( | ||
"E_MISSING_IANA_TZ", | ||
"Missing required IANA timezone content for `{timeZone}`: `{path}`.", | ||
value, | ||
{ | ||
path: path.replace( /globalize-iana\//, "" ), | ||
timeZone: timeZone | ||
} | ||
); | ||
}; | ||
} | ||
/** | ||
* .loadIANATimezone( json ) | ||
* | ||
* @json [JSON] | ||
* | ||
* Load IANA timezone data. | ||
*/ | ||
Globalize.loadIANATimezone = function( json ) { | ||
var customData = { | ||
"globalize-iana": json | ||
}; | ||
validateParameterPresence( json, "json" ); | ||
validateParameterTypePlainObject( json, "json" ); | ||
Cldr.load( customData ); | ||
}; | ||
/** | ||
* .dateFormatter( options ) | ||
@@ -2552,4 +2172,3 @@ * | ||
Globalize.prototype.dateToPartsFormatter = function( options ) { | ||
var args, cldr, numberFormatters, pad, pattern, properties, returnFn, | ||
timeZone; | ||
var args, cldr, numberFormatters, pad, pattern, properties, returnFn; | ||
@@ -2559,6 +2178,3 @@ validateParameterTypePlainObject( options, "options" ); | ||
cldr = this.cldr; | ||
options = options || {}; | ||
if ( !optionsHasStyle( options ) ) { | ||
options.skeleton = "yMd"; | ||
} | ||
options = options || { skeleton: "yMd" }; | ||
@@ -2568,18 +2184,9 @@ validateOptionsPreset( options ); | ||
timeZone = options.timeZone; | ||
validateParameterTypeString( timeZone, "options.timeZone" ); | ||
args = [ options ]; | ||
cldr.on( "get", validateRequiredCldr ); | ||
if ( timeZone ) { | ||
cldr.on( "get", validateRequiredIana( timeZone ) ); | ||
} | ||
pattern = dateExpandPattern( options, cldr ); | ||
validateOptionsSkeleton( pattern, options.skeleton ); | ||
properties = dateFormatProperties( pattern, cldr, timeZone ); | ||
properties = dateFormatProperties( pattern, cldr ); | ||
cldr.off( "get", validateRequiredCldr ); | ||
if ( timeZone ) { | ||
cldr.off( "get", validateRequiredIana( timeZone ) ); | ||
} | ||
@@ -2612,4 +2219,3 @@ // Create needed number formatters. | ||
Globalize.prototype.dateParser = function( options ) { | ||
var args, cldr, numberParser, parseProperties, pattern, returnFn, timeZone, | ||
tokenizerProperties; | ||
var args, cldr, numberParser, parseProperties, pattern, tokenizerProperties, returnFn; | ||
@@ -2619,6 +2225,3 @@ validateParameterTypePlainObject( options, "options" ); | ||
cldr = this.cldr; | ||
options = options || {}; | ||
if ( !optionsHasStyle( options ) ) { | ||
options.skeleton = "yMd"; | ||
} | ||
options = options || { skeleton: "yMd" }; | ||
@@ -2628,19 +2231,10 @@ validateOptionsPreset( options ); | ||
timeZone = options.timeZone; | ||
validateParameterTypeString( timeZone, "options.timeZone" ); | ||
args = [ options ]; | ||
cldr.on( "get", validateRequiredCldr ); | ||
if ( timeZone ) { | ||
cldr.on( "get", validateRequiredIana( timeZone ) ); | ||
} | ||
pattern = dateExpandPattern( options, cldr ); | ||
validateOptionsSkeleton( pattern, options.skeleton ); | ||
tokenizerProperties = dateTokenizerProperties( pattern, cldr ); | ||
parseProperties = dateParseProperties( cldr, timeZone ); | ||
parseProperties = dateParseProperties( cldr ); | ||
cldr.off( "get", validateRequiredCldr ); | ||
if ( timeZone ) { | ||
cldr.off( "get", validateRequiredIana( timeZone ) ); | ||
} | ||
@@ -2647,0 +2241,0 @@ numberParser = this.numberParser({ raw: "0" }); |
/** | ||
* Globalize v1.3.0-alpha.1 | ||
* Globalize v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize v1.3.0-alpha.1 | ||
* Globalize v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize v1.3.0-alpha.1 | ||
* Globalize v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize v1.3.0-alpha.1 | ||
* Globalize v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/** | ||
* Globalize v1.3.0-alpha.1 | ||
* Globalize v1.3.0-alpha.2 | ||
* | ||
@@ -10,6 +10,6 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
/*! | ||
* Globalize v1.3.0-alpha.1 2017-04-07T21:07Z Released under the MIT license | ||
* Globalize v1.3.0-alpha.2 2017-04-12T23:38Z Released under the MIT license | ||
* http://git.io/TrdQbw | ||
@@ -16,0 +16,0 @@ */ |
/*! | ||
* Globalize v1.3.0-alpha.1 | ||
* Globalize v1.3.0-alpha.2 | ||
* | ||
@@ -10,3 +10,3 @@ * http://github.com/jquery/globalize | ||
* | ||
* Date: 2017-04-07T21:07Z | ||
* Date: 2017-04-12T23:38Z | ||
*/ | ||
@@ -13,0 +13,0 @@ |
@@ -57,8 +57,2 @@ ## .dateFormatter( [options] ) ➜ function( value ) | ||
> Use `skeleton` instead. | ||
> | ||
> **timeZone** | ||
> | ||
> String based on the time zone names of the [IANA time zone | ||
> database](https://www.iana.org/time-zones), such as `"Asia/Shanghai"`, `"Asia/Kolkata"`, | ||
> `"America/New_York"`. | ||
@@ -73,8 +67,11 @@ **value** | ||
`cldr/main/{locale}/ca-gregorian.json`, `cldr/main/{locale}/timeZoneNames.json`, | ||
`cldr/supplemental/metaZones.json`, `cldr/supplemental/timeData.json`, | ||
`cldr/supplemental/weekData.json`, and the CLDR content required by the number | ||
module. Read [CLDR content][] if you need more information. | ||
`cldr/supplemental/timeData.json`, `cldr/supplemental/weekData.json`, and the | ||
CLDR content required by the number module. Read [CLDR content][] if you need | ||
more information. | ||
[CLDR content]: ../../../README.md#2-cldr-content | ||
You can use the static method `Globalize.dateFormatter()`, which uses the default | ||
locale. | ||
```javascript | ||
@@ -114,8 +111,8 @@ var formatter; | ||
| `{ time: "medium" }` | `"5:55:00 PM"` | | ||
| `{ time: "long" }` | `"5:55:00 PM PST"` | | ||
| `{ time: "full" }` | `"5:55:00 PM Pacific Standard Time"` | | ||
| `{ time: "long" }` | `"5:55:00 PM GMT-2"` | | ||
| `{ time: "full" }` | `"5:55:00 PM GMT-02:00"` | | ||
| `{ datetime: "short" }` | `"11/1/10, 5:55 PM"` | | ||
| `{ datetime: "medium" }` | `"Nov 1, 2010, 5:55:00 PM"` | | ||
| `{ datetime: "long" }` | `"November 1, 2010 at 5:55:00 PM PST"` | | ||
| `{ datetime: "full" }` | `"Monday, November 1, 2010 at 5:55:00 PM Pacific Standard Time"` | | ||
| `{ datetime: "long" }` | `"November 1, 2010 at 5:55:00 PM GMT-2"` | | ||
| `{ datetime: "full" }` | `"Monday, November 1, 2010 at 5:55:00 PM GMT-02:00"` | | ||
@@ -192,22 +189,2 @@ For comparison, follow the same formatter `{ datetime: "short" }` on different locales. | ||
Using specific timeZones, i.e., using `options.timezone`. Note that prior to using | ||
it, you must load IANA Timezone Data. | ||
```js | ||
Globalize.loadIANATimezone( require( "iana-tz-data" ) ); | ||
``` | ||
```js | ||
Globalize.locale( "en" ); | ||
Globalize.dateFormatter({ datetime: "medium", timeZone: "America/Los_Angeles" })( new Date() ); | ||
// > "Nov 1, 2010, 12:55:00 PM" | ||
Globalize.dateFormatter({ datetime: "medium", timeZone: "America/Sao_Paulo" })( new Date() ) | ||
// > "Nov 1, 2010, 5:55:00 PM" | ||
Globalize.dateFormatter({ datetime: "full", timeZone: "Europe/Berlin" })( new Date() ) | ||
// > "Monday, November 1, 2010 at 8:55:00 PM Central European Standard Time" | ||
``` | ||
For improved performance on iterations, first create the formatter. Then, reuse | ||
@@ -214,0 +191,0 @@ it on each loop. |
@@ -98,3 +98,3 @@ ## .dateToPartsFormatter( [options] ) ➜ function( value ) | ||
formatter( new Date( 2010, 10, 30, 17, 55 ) ); | ||
formatter( new Date( 2010, 10, 30 ) ); | ||
// > [ | ||
@@ -115,3 +115,3 @@ // { "type": "month", "value": "11" }, | ||
enFormatter( new Date( 2010, 10, 30, 17, 55 ) ); | ||
enFormatter( new Date( 2010, 10, 30 ) ); | ||
// > [ | ||
@@ -125,3 +125,3 @@ // { "type": "month", "value": "11" }, | ||
deFormatter( new Date( 2010, 10, 30, 17, 55 ) ); | ||
deFormatter( new Date( 2010, 10, 30 ) ); | ||
// > [ | ||
@@ -151,3 +151,3 @@ // { type: 'day', value: '30' }, | ||
Globalize.locale( "en" ); | ||
formatter = Globalize.dateToPartsFormatter(); | ||
formatter = Globalize.dateToPartsFormatter({datetime: "short"}); | ||
@@ -157,6 +157,6 @@ formatter( new Date( 2010, 10, 30, 17, 55 ) ).map(({type, value}) => { | ||
case "year": return `<strong>${value}</strong>`; | ||
default : return value; | ||
default: return value; | ||
} | ||
}).join( "" ); | ||
// > "11/30/<strong>2010</strong>" | ||
// > "11/30/<strong>10</strong>, 5:55 PM" | ||
``` | ||
@@ -163,0 +163,0 @@ |
@@ -14,2 +14,17 @@ var Globalize = require( "globalize" ); | ||
var _dateToPartsFormatter = Globalize.dateToPartsFormatter({ datetime: "medium" }); | ||
var dateToPartsFormatter = function( value ) { | ||
return _dateToPartsFormatter( value, { | ||
datetime: "medium" | ||
}).map(function( part ) { | ||
switch(part.type) { | ||
case "month": return "<strong>" + part.value + "</strong>"; | ||
default: return part.value; | ||
} | ||
}).reduce(function( memo, value ) { | ||
return memo + value; | ||
}); | ||
}; | ||
document.getElementById( "date-to-parts" ).innerHTML = dateToPartsFormatter( new Date() ); | ||
var relativeTimeFormatter = Globalize.relativeTimeFormatter( "second" ); | ||
@@ -26,2 +41,3 @@ document.getElementById( "relative-time" ).textContent = relativeTimeFormatter( 0 ); | ||
document.getElementById( "date-label" ).textContent = Globalize.formatMessage( "date-label" ); | ||
document.getElementById( "date-to-parts-label" ).textContent = Globalize.formatMessage( "date-to-parts-label" ); | ||
document.getElementById( "relative-time-label" ).textContent = Globalize.formatMessage( "relative-time-label" ); | ||
@@ -49,2 +65,3 @@ document.getElementById( "unit-label" ).textContent = Globalize.formatMessage( "unit-label" ); | ||
document.getElementById( "date" ).textContent = dateFormatter( new Date() ); | ||
document.getElementById( "date-to-parts" ).innerHTML = dateToPartsFormatter( new Date() ); | ||
document.getElementById( "relative-time" ).textContent = relativeTimeFormatter( elapsedTime ); | ||
@@ -51,0 +68,0 @@ document.getElementById( "message-1" ).textContent = Globalize.formatMessage( "message-1", { |
@@ -7,2 +7,3 @@ { | ||
"date-label": "تاريخ", | ||
"date-to-parts-label": "التاريخ (لاحظ الشهر القوي، تمت إضافة الترميز باستخدام formatDateToParts)", | ||
"relative-time-label": "الوقت النسبي", | ||
@@ -9,0 +10,0 @@ "unit-label": "وحدة القياس", |
@@ -7,2 +7,3 @@ { | ||
"date-label": "Datum", | ||
"date-to-parts-label": "Datum (beachten Sie den hervorgehobenen Monat, das Markup wurde mit dateToPartsFormatter hinzugefügt)", | ||
"relative-time-label": "Relative Zeit", | ||
@@ -9,0 +10,0 @@ "unit-label": "Einheit", |
@@ -7,2 +7,3 @@ { | ||
"date-label": "Date", | ||
"date-to-parts-label": "Date (note the highlighted month, the markup was added using formatDateToParts)", | ||
"relative-time-label": "Relative Time", | ||
@@ -9,0 +10,0 @@ "unit-label": "Unit", |
@@ -7,2 +7,3 @@ { | ||
"date-label": "Fecha", | ||
"date-to-parts-label": "Fecha (note el mes destacado en negro, el marcador de html se agregó utilizando dateToPartsFormatter)", | ||
"relative-time-label": "Tiempo Relativo", | ||
@@ -9,0 +10,0 @@ "unit-label": "Unidad", |
@@ -7,2 +7,3 @@ { | ||
"date-label": "Data", | ||
"date-to-parts-label": "Data (note o mês em negrito, a marcação HTML foi adicionada usando formatDateToParts)", | ||
"relative-time-label": "Tempo relativo", | ||
@@ -9,0 +10,0 @@ "unit-label": "Unit", |
@@ -7,2 +7,3 @@ { | ||
"date-label": "Дата", | ||
"date-to-parts-label": "Дата (обратите внимание на сильный месяц, разметка была добавлена с помощью formatDateToParts)", | ||
"relative-time-label": "Относительное время", | ||
@@ -9,0 +10,0 @@ "unit-label": "Единица измерения", |
@@ -7,2 +7,3 @@ { | ||
"date-label": "迄今", | ||
"date-to-parts-label": "日期(注意强烈的月份,使用formatDateToParts添加标记)", | ||
"relative-time-label": "相对时间", | ||
@@ -9,0 +10,0 @@ "unit-label": "单元", |
@@ -11,6 +11,2 @@ var like, number; | ||
// Use Globalize to format numbers. | ||
number = Globalize.numberFormatter(); | ||
document.getElementById( "number" ).textContent = number( 12345.6789 ); | ||
// Use Globalize to format dates to parts. | ||
@@ -28,2 +24,6 @@ document.getElementById( "dateToParts" ).innerHTML = Globalize.formatDateToParts( new Date(), { | ||
// Use Globalize to format numbers. | ||
number = Globalize.numberFormatter(); | ||
document.getElementById( "number" ).textContent = number( 12345.6789 ); | ||
// Use Globalize to format currencies. | ||
@@ -30,0 +30,0 @@ document.getElementById( "currency" ).textContent = Globalize.formatCurrency( 69900, "USD" ); |
{ | ||
"name": "globalize", | ||
"version": "1.3.0-alpha.1", | ||
"version": "1.3.0-alpha.2", | ||
"description": "A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data.", | ||
@@ -92,3 +92,2 @@ "keywords": [ | ||
"gzip-js": "0.3.2", | ||
"iana-tz-data": "0.0.4", | ||
"matchdep": "0.3.0" | ||
@@ -95,0 +94,0 @@ }, |
@@ -248,3 +248,3 @@ # Globalize | ||
| Currency module | cldr/main/`locale`/currencies.json<br>cldr/supplemental/currencyData.json<br>+CLDR JSON files from number module<br>+CLDR JSON files from plural module for name style support | | ||
| Date module | cldr/main/`locale`/ca-gregorian.json<br>cldr/main/`locale`/timeZoneNames.json<br>cldr/supplemental/metaZones.json<br>cldr/supplemental/timeData.json<br>cldr/supplemental/weekData.json<br>+CLDR JSON files from number module | | ||
| Date module | cldr/main/`locale`/ca-gregorian.json<br>cldr/main/`locale`/timeZoneNames.json<br>cldr/supplemental/timeData.json<br>cldr/supplemental/weekData.json<br>+CLDR JSON files from number module | | ||
| Number module | cldr/main/`locale`/numbers.json<br>cldr/supplemental/numberingSystems.json | | ||
@@ -251,0 +251,0 @@ | Plural module | cldr/supplemental/plurals.json (for cardinals)<br>cldr/supplemental/ordinals.json (for ordinals) | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17
434572
9384