@wordpress/date
Advanced tools
Comparing version 3.7.0 to 3.8.0
### WordPress - Web publishing software | ||
Copyright 2011-2019 by the contributors | ||
Copyright 2011-2020 by the contributors | ||
@@ -5,0 +5,0 @@ This program is free software; you can redistribute it and/or modify |
{ | ||
"name": "@wordpress/date", | ||
"version": "3.7.0", | ||
"version": "3.8.0", | ||
"description": "Date module for WordPress.", | ||
@@ -24,3 +24,3 @@ "author": "The WordPress Contributors", | ||
"dependencies": { | ||
"@babel/runtime": "^7.4.4", | ||
"@babel/runtime": "^7.8.3", | ||
"moment": "^2.22.1", | ||
@@ -32,3 +32,3 @@ "moment-timezone": "^0.5.16" | ||
}, | ||
"gitHead": "cc8b3fde75738a15c6152d18458eb5078a620cbe" | ||
"gitHead": "41fc84af285da696c65c235331ee245dfe23971d" | ||
} |
@@ -17,5 +17,39 @@ /** | ||
locale: 'en', | ||
months: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ], | ||
monthsShort: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ], | ||
weekdays: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ], | ||
months: [ | ||
'January', | ||
'February', | ||
'March', | ||
'April', | ||
'May', | ||
'June', | ||
'July', | ||
'August', | ||
'September', | ||
'October', | ||
'November', | ||
'December', | ||
], | ||
monthsShort: [ | ||
'Jan', | ||
'Feb', | ||
'Mar', | ||
'Apr', | ||
'May', | ||
'Jun', | ||
'Jul', | ||
'Aug', | ||
'Sep', | ||
'Oct', | ||
'Nov', | ||
'Dec', | ||
], | ||
weekdays: [ | ||
'Sunday', | ||
'Monday', | ||
'Tuesday', | ||
'Wednesday', | ||
'Thursday', | ||
'Friday', | ||
'Saturday', | ||
], | ||
weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ], | ||
@@ -68,5 +102,9 @@ meridiem: { am: 'am', pm: 'pm', AM: 'AM', PM: 'PM' }, | ||
if ( hour < 12 ) { | ||
return isLowercase ? dateSettings.l10n.meridiem.am : dateSettings.l10n.meridiem.AM; | ||
return isLowercase | ||
? dateSettings.l10n.meridiem.am | ||
: dateSettings.l10n.meridiem.AM; | ||
} | ||
return isLowercase ? dateSettings.l10n.meridiem.pm : dateSettings.l10n.meridiem.PM; | ||
return isLowercase | ||
? dateSettings.l10n.meridiem.pm | ||
: dateSettings.l10n.meridiem.PM; | ||
}, | ||
@@ -101,8 +139,10 @@ longDateFormat: { | ||
// Create WP timezone based off dateSettings. | ||
momentLib.tz.add( momentLib.tz.pack( { | ||
name: WP_ZONE, | ||
abbrs: [ WP_ZONE ], | ||
untils: [ null ], | ||
offsets: [ -settings.timezone.offset * 60 || 0 ], | ||
} ) ); | ||
momentLib.tz.add( | ||
momentLib.tz.pack( { | ||
name: WP_ZONE, | ||
abbrs: [ WP_ZONE ], | ||
untils: [ null ], | ||
offsets: [ -settings.timezone.offset * 60 || 0 ], | ||
} ) | ||
); | ||
} | ||
@@ -227,7 +267,6 @@ | ||
return parseInt( | ||
( | ||
seconds + | ||
( minutes * MINUTE_IN_SECONDS ) + | ||
( hours * HOUR_IN_SECONDS ) | ||
) / 86.4, | ||
( seconds + | ||
minutes * MINUTE_IN_SECONDS + | ||
hours * HOUR_IN_SECONDS ) / | ||
86.4, | ||
10 | ||
@@ -271,3 +310,7 @@ ); | ||
const parts = offset.substring( 1 ).split( ':' ); | ||
return sign * ( ( parts[ 0 ] * HOUR_IN_MINUTES ) + parts[ 1 ] ) * MINUTE_IN_SECONDS; | ||
return ( | ||
sign * | ||
( parts[ 0 ] * HOUR_IN_MINUTES + parts[ 1 ] ) * | ||
MINUTE_IN_SECONDS | ||
); | ||
}, | ||
@@ -274,0 +317,0 @@ // Full date/time |
/** | ||
* Internal dependencies | ||
*/ | ||
import { isInTheFuture, getDate, setSettings, __experimentalGetSettings } from '../'; | ||
import { | ||
isInTheFuture, | ||
getDate, | ||
setSettings, | ||
__experimentalGetSettings, | ||
} from '../'; | ||
@@ -9,3 +14,3 @@ describe( 'isInTheFuture', () => { | ||
// Create a Date object 1 minute in the future. | ||
const date = new Date( Number( getDate() ) + ( 1000 * 60 ) ); | ||
const date = new Date( Number( getDate() ) + 1000 * 60 ); | ||
@@ -17,3 +22,3 @@ expect( isInTheFuture( date ) ).toBe( true ); | ||
// Create a Date object 1 minute in the past. | ||
const date = new Date( Number( getDate() ) - ( 1000 * 60 ) ); | ||
const date = new Date( Number( getDate() ) - 1000 * 60 ); | ||
@@ -32,7 +37,7 @@ expect( isInTheFuture( date ) ).toBe( false ); | ||
// Create a Date object 1 minute in the past. | ||
let date = new Date( Number( getDate() ) - ( 1000 * 60 ) ); | ||
let date = new Date( Number( getDate() ) - 1000 * 60 ); | ||
expect( isInTheFuture( date ) ).toBe( false ); | ||
// Create a Date object 1 minute in the future. | ||
date = new Date( Number( getDate() ) + ( 1000 * 60 ) ); | ||
date = new Date( Number( getDate() ) + 1000 * 60 ); | ||
expect( isInTheFuture( date ) ).toBe( true ); | ||
@@ -39,0 +44,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
102112
1239
Updated@babel/runtime@^7.8.3