@wordpress/date
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -12,3 +12,3 @@ /** | ||
l10n: { | ||
locale: 'en_US', | ||
locale: 'en', | ||
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], | ||
@@ -25,4 +25,16 @@ monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], | ||
relative: { | ||
future: ' % s from now', | ||
past: '% s ago' | ||
future: '%s from now', | ||
past: '%s ago', | ||
s: 'a few seconds', | ||
ss: '%d seconds', | ||
m: 'a minute', | ||
mm: '%d minutes', | ||
h: 'an hour', | ||
hh: '%d hours', | ||
d: 'a day', | ||
dd: '%d days', | ||
M: 'a month', | ||
MM: '%d months', | ||
y: 'a year', | ||
yy: '%d years' | ||
} | ||
@@ -75,17 +87,3 @@ }, | ||
// Set to `(number, withoutSuffix, key, isFuture) => {}` instead. | ||
relativeTime: { | ||
future: dateSettings.l10n.relative.future, | ||
past: dateSettings.l10n.relative.past, | ||
s: 'seconds', | ||
m: 'a minute', | ||
mm: '%d minutes', | ||
h: 'an hour', | ||
hh: '%d hours', | ||
d: 'a day', | ||
dd: '%d days', | ||
M: 'a month', | ||
MM: '%d months', | ||
y: 'a year', | ||
yy: '%d years' | ||
} | ||
relativeTime: dateSettings.l10n.relative | ||
}); | ||
@@ -118,3 +116,3 @@ momentLib.locale(currentLocale); | ||
* | ||
* @type {Number} | ||
* @type {number} | ||
*/ | ||
@@ -127,3 +125,3 @@ | ||
* | ||
* @type {Number} | ||
* @type {number} | ||
*/ | ||
@@ -135,3 +133,3 @@ | ||
* | ||
* @type {Number} | ||
* @type {number} | ||
*/ | ||
@@ -138,0 +136,0 @@ |
@@ -31,3 +31,3 @@ "use strict"; | ||
l10n: { | ||
locale: 'en_US', | ||
locale: 'en', | ||
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], | ||
@@ -44,4 +44,16 @@ monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], | ||
relative: { | ||
future: ' % s from now', | ||
past: '% s ago' | ||
future: '%s from now', | ||
past: '%s ago', | ||
s: 'a few seconds', | ||
ss: '%d seconds', | ||
m: 'a minute', | ||
mm: '%d minutes', | ||
h: 'an hour', | ||
hh: '%d hours', | ||
d: 'a day', | ||
dd: '%d days', | ||
M: 'a month', | ||
MM: '%d months', | ||
y: 'a year', | ||
yy: '%d years' | ||
} | ||
@@ -95,17 +107,3 @@ }, | ||
// Set to `(number, withoutSuffix, key, isFuture) => {}` instead. | ||
relativeTime: { | ||
future: dateSettings.l10n.relative.future, | ||
past: dateSettings.l10n.relative.past, | ||
s: 'seconds', | ||
m: 'a minute', | ||
mm: '%d minutes', | ||
h: 'an hour', | ||
hh: '%d hours', | ||
d: 'a day', | ||
dd: '%d days', | ||
M: 'a month', | ||
MM: '%d months', | ||
y: 'a year', | ||
yy: '%d years' | ||
} | ||
relativeTime: dateSettings.l10n.relative | ||
}); | ||
@@ -141,3 +139,3 @@ | ||
* | ||
* @type {Number} | ||
* @type {number} | ||
*/ | ||
@@ -150,3 +148,3 @@ | ||
* | ||
* @type {Number} | ||
* @type {number} | ||
*/ | ||
@@ -158,3 +156,3 @@ | ||
* | ||
* @type {Number} | ||
* @type {number} | ||
*/ | ||
@@ -161,0 +159,0 @@ |
{ | ||
"name": "@wordpress/date", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Date module for WordPress.", | ||
@@ -31,3 +31,3 @@ "author": "The WordPress Contributors", | ||
}, | ||
"gitHead": "2080b50d4a41c9f746485519d1dc368dd9d9354d" | ||
"gitHead": "989502eccaadee1ea7666d6d9fb9f4d08b274546" | ||
} |
@@ -14,3 +14,3 @@ /** | ||
l10n: { | ||
locale: 'en_US', | ||
locale: 'en', | ||
months: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ], | ||
@@ -21,3 +21,18 @@ monthsShort: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ], | ||
meridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' }, | ||
relative: { future: ' % s from now', past: '% s ago' }, | ||
relative: { | ||
future: '%s from now', | ||
past: '%s ago', | ||
s: 'a few seconds', | ||
ss: '%d seconds', | ||
m: 'a minute', | ||
mm: '%d minutes', | ||
h: 'an hour', | ||
hh: '%d hours', | ||
d: 'a day', | ||
dd: '%d days', | ||
M: 'a month', | ||
MM: '%d months', | ||
y: 'a year', | ||
yy: '%d years', | ||
}, | ||
}, | ||
@@ -66,17 +81,3 @@ formats: { | ||
// Set to `(number, withoutSuffix, key, isFuture) => {}` instead. | ||
relativeTime: { | ||
future: dateSettings.l10n.relative.future, | ||
past: dateSettings.l10n.relative.past, | ||
s: 'seconds', | ||
m: 'a minute', | ||
mm: '%d minutes', | ||
h: 'an hour', | ||
hh: '%d hours', | ||
d: 'a day', | ||
dd: '%d days', | ||
M: 'a month', | ||
MM: '%d months', | ||
y: 'a year', | ||
yy: '%d years', | ||
}, | ||
relativeTime: dateSettings.l10n.relative, | ||
} ); | ||
@@ -111,3 +112,3 @@ momentLib.locale( currentLocale ); | ||
* | ||
* @type {Number} | ||
* @type {number} | ||
*/ | ||
@@ -118,3 +119,3 @@ const MINUTE_IN_SECONDS = 60; | ||
* | ||
* @type {Number} | ||
* @type {number} | ||
*/ | ||
@@ -125,3 +126,3 @@ const HOUR_IN_MINUTES = 60; | ||
* | ||
* @type {Number} | ||
* @type {number} | ||
*/ | ||
@@ -128,0 +129,0 @@ const HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS; |
@@ -41,1 +41,33 @@ /** | ||
} ); | ||
describe( 'Moment.js Localization', () => { | ||
it( 'should change the relative time strings', () => { | ||
const settings = __experimentalGetSettings(); | ||
// Change the locale strings for tests. | ||
setSettings( { | ||
...settings, | ||
l10n: { | ||
...settings.l10n, | ||
relative: { | ||
...settings.l10n.relative, | ||
mm: '%d localized minutes', | ||
hh: '%d localized hours', | ||
}, | ||
}, | ||
} ); | ||
// Get the freshly changed setings. | ||
const newSettings = __experimentalGetSettings(); | ||
// Test the unchanged values. | ||
expect( newSettings.l10n.locale ).toBe( settings.l10n.locale ); | ||
// Test the changed values. | ||
expect( newSettings.l10n.relative.mm ).toBe( '%d localized minutes' ); | ||
expect( newSettings.l10n.relative.hh ).toBe( '%d localized hours' ); | ||
// Restore default settings | ||
setSettings( settings ); | ||
} ); | ||
} ); |
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
100589
1188