mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Fixed schedule time changing after setting if local and site tz don't match
closes https://github.com/TryGhost/Team/issues/1622 - we were setting selected hour/minute on a supposedly site-timezone date before converting to UTC but we were using a local timezone date instead meaning the conversion to UTC didn't match resulting in the time being altered incorrectly after the time input loses focus
This commit is contained in:
parent
513c8655e4
commit
dd551acf91
1 changed files with 4 additions and 1 deletions
|
@ -1,8 +1,11 @@
|
||||||
import Component from '@glimmer/component';
|
import Component from '@glimmer/component';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import {action} from '@ember/object';
|
import {action} from '@ember/object';
|
||||||
|
import {inject as service} from '@ember/service';
|
||||||
|
|
||||||
export default class PublishAtOption extends Component {
|
export default class PublishAtOption extends Component {
|
||||||
|
@service settings;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
setDate(selectedDate) {
|
setDate(selectedDate) {
|
||||||
const newDate = moment(this.args.publishOptions.scheduledAtUTC);
|
const newDate = moment(this.args.publishOptions.scheduledAtUTC);
|
||||||
|
@ -35,7 +38,7 @@ export default class PublishAtOption extends Component {
|
||||||
|
|
||||||
// hour/minute will be the site timezone equivalent but we need the hour/minute
|
// hour/minute will be the site timezone equivalent but we need the hour/minute
|
||||||
// as it would be in UTC
|
// as it would be in UTC
|
||||||
const conversionDate = moment();
|
const conversionDate = moment().tz(this.settings.get('timezone'));
|
||||||
conversionDate.set({hour, minute});
|
conversionDate.set({hour, minute});
|
||||||
const utcDate = moment.utc(conversionDate);
|
const utcDate = moment.utc(conversionDate);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue