mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
🐛 Fixed date helper timezone bug (#9382)
closes #9381 Fixes a bug where the date helper would ignore any timezone settings, when called with a specific date option, e. g. `published_at`.
This commit is contained in:
parent
a1393762f6
commit
c3b0219d70
1 changed files with 7 additions and 6 deletions
|
@ -13,6 +13,8 @@ module.exports = function (date, options) {
|
||||||
if (!options && date.hasOwnProperty('hash')) {
|
if (!options && date.hasOwnProperty('hash')) {
|
||||||
options = date;
|
options = date;
|
||||||
date = undefined;
|
date = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
timezone = options.data.blog.timezone;
|
timezone = options.data.blog.timezone;
|
||||||
|
|
||||||
// set to published_at by default, if it's available
|
// set to published_at by default, if it's available
|
||||||
|
@ -20,7 +22,6 @@ module.exports = function (date, options) {
|
||||||
if (this.published_at) {
|
if (this.published_at) {
|
||||||
date = moment(this.published_at).tz(timezone).format();
|
date = moment(this.published_at).tz(timezone).format();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// ensure that context is undefined, not null, as that can cause errors
|
// ensure that context is undefined, not null, as that can cause errors
|
||||||
date = date === null ? undefined : date;
|
date = date === null ? undefined : date;
|
||||||
|
|
Loading…
Add table
Reference in a new issue