@wordpress/date
Advanced tools
Comparing version 4.41.1-next.5a1d1283.0 to 4.42.0
@@ -194,9 +194,25 @@ /** | ||
function setupWPTimezone() { | ||
// 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] | ||
})); | ||
// Get the current timezone settings from the WP timezone string. | ||
const currentTimezone = momentLib.tz.zone(settings.timezone.string); | ||
// Check to see if we have a valid TZ data, if so, use it for the custom WP_ZONE timezone, otherwise just use the offset. | ||
if (currentTimezone) { | ||
// Create WP timezone based off settings.timezone.string. We need to include the additional data so that we | ||
// don't lose information about daylight savings time and other items. | ||
// See https://github.com/WordPress/gutenberg/pull/48083 | ||
momentLib.tz.add(momentLib.tz.pack({ | ||
name: WP_ZONE, | ||
abbrs: currentTimezone.abbrs, | ||
untils: currentTimezone.untils, | ||
offsets: currentTimezone.offsets | ||
})); | ||
} else { | ||
// 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] | ||
})); | ||
} | ||
} | ||
@@ -203,0 +219,0 @@ |
@@ -211,9 +211,25 @@ "use strict"; | ||
function setupWPTimezone() { | ||
// Create WP timezone based off dateSettings. | ||
_moment.default.tz.add(_moment.default.tz.pack({ | ||
name: WP_ZONE, | ||
abbrs: [WP_ZONE], | ||
untils: [null], | ||
offsets: [-settings.timezone.offset * 60 || 0] | ||
})); | ||
// Get the current timezone settings from the WP timezone string. | ||
const currentTimezone = _moment.default.tz.zone(settings.timezone.string); | ||
// Check to see if we have a valid TZ data, if so, use it for the custom WP_ZONE timezone, otherwise just use the offset. | ||
if (currentTimezone) { | ||
// Create WP timezone based off settings.timezone.string. We need to include the additional data so that we | ||
// don't lose information about daylight savings time and other items. | ||
// See https://github.com/WordPress/gutenberg/pull/48083 | ||
_moment.default.tz.add(_moment.default.tz.pack({ | ||
name: WP_ZONE, | ||
abbrs: currentTimezone.abbrs, | ||
untils: currentTimezone.untils, | ||
offsets: currentTimezone.offsets | ||
})); | ||
} else { | ||
// Create WP timezone based off dateSettings. | ||
_moment.default.tz.add(_moment.default.tz.pack({ | ||
name: WP_ZONE, | ||
abbrs: [WP_ZONE], | ||
untils: [null], | ||
offsets: [-settings.timezone.offset * 60 || 0] | ||
})); | ||
} | ||
} | ||
@@ -220,0 +236,0 @@ |
@@ -5,2 +5,4 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
## 4.42.0 (2023-09-20) | ||
## 4.41.0 (2023-08-31) | ||
@@ -7,0 +9,0 @@ |
{ | ||
"name": "@wordpress/date", | ||
"version": "4.41.1-next.5a1d1283.0", | ||
"version": "4.42.0", | ||
"description": "Date module for WordPress.", | ||
@@ -30,3 +30,3 @@ "author": "The WordPress Contributors", | ||
"@babel/runtime": "^7.16.0", | ||
"@wordpress/deprecated": "^3.41.1-next.5a1d1283.0", | ||
"@wordpress/deprecated": "^3.42.0", | ||
"moment": "^2.29.4", | ||
@@ -38,3 +38,3 @@ "moment-timezone": "^0.5.40" | ||
}, | ||
"gitHead": "fa0b66987dab5a15f38663e06036d09bccffaa4b" | ||
"gitHead": "cc35f517ed017ab7131319af3e87c359e8de175d" | ||
} |
@@ -229,11 +229,29 @@ /** | ||
function setupWPTimezone() { | ||
// 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 ], | ||
} ) | ||
); | ||
// Get the current timezone settings from the WP timezone string. | ||
const currentTimezone = momentLib.tz.zone( settings.timezone.string ); | ||
// Check to see if we have a valid TZ data, if so, use it for the custom WP_ZONE timezone, otherwise just use the offset. | ||
if ( currentTimezone ) { | ||
// Create WP timezone based off settings.timezone.string. We need to include the additional data so that we | ||
// don't lose information about daylight savings time and other items. | ||
// See https://github.com/WordPress/gutenberg/pull/48083 | ||
momentLib.tz.add( | ||
momentLib.tz.pack( { | ||
name: WP_ZONE, | ||
abbrs: currentTimezone.abbrs, | ||
untils: currentTimezone.untils, | ||
offsets: currentTimezone.offsets, | ||
} ) | ||
); | ||
} else { | ||
// 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 ], | ||
} ) | ||
); | ||
} | ||
} | ||
@@ -240,0 +258,0 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
205351
2555
0