0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

🐛 Fixed timezone issue with min/max dates in datetime picker

fixes #15497

`'now'` option for min/max date used `moment()` function and did not consider the timezone of the site.
This commit is contained in:
Ozan Uslan 2022-10-06 21:09:36 +03:00 committed by GitHub
parent e871aabb70
commit 220af3b276
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,7 +121,7 @@ export default class GhDateTimePicker extends Component {
// unless min/max date is at midnight moment will disable that day
if (minDate === 'now') {
this.set('_minDate', moment(moment().format(DATE_FORMAT)));
this.set('_minDate', moment.tz(moment().tz(blogTimezone).format(DATE_FORMAT), blogTimezone));
} else if (!isBlank(minDate)) {
this.set('_minDate', moment(moment(minDate).format(DATE_FORMAT)));
} else {
@ -129,7 +129,7 @@ export default class GhDateTimePicker extends Component {
}
if (maxDate === 'now') {
this.set('_maxDate', moment(moment().format(DATE_FORMAT)));
this.set('_maxDate', moment.tz(moment().tz(blogTimezone).format(DATE_FORMAT), blogTimezone));
} else if (!isBlank(maxDate)) {
this.set('_maxDate', moment(moment(maxDate).format(DATE_FORMAT)));
} else {