0
Fork 0
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:
汪磊 2018-01-09 18:44:01 +08:00 committed by Aileen Nowak
parent a1393762f6
commit c3b0219d70

View file

@ -13,6 +13,8 @@ module.exports = function (date, options) {
if (!options && date.hasOwnProperty('hash')) {
options = date;
date = undefined;
}
timezone = options.data.blog.timezone;
// set to published_at by default, if it's available
@ -20,7 +22,6 @@ module.exports = function (date, options) {
if (this.published_at) {
date = moment(this.published_at).tz(timezone).format();
}
}
// ensure that context is undefined, not null, as that can cause errors
date = date === null ? undefined : date;