mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-25 02:31:59 -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,13 +13,14 @@ 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;
|
}
|
||||||
|
|
||||||
// set to published_at by default, if it's available
|
timezone = options.data.blog.timezone;
|
||||||
// otherwise, this will print the current date
|
|
||||||
if (this.published_at) {
|
// set to published_at by default, if it's available
|
||||||
date = moment(this.published_at).tz(timezone).format();
|
// otherwise, this will print the current date
|
||||||
}
|
if (this.published_at) {
|
||||||
|
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue