Pass the date to getTimezoneOffset() so that the DST is accounted for
See https://github.com/marnusw/date-fns-tz#gettimezoneoffset Closes #1069 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
72ed766f26
commit
35fb06c345
@ -169,17 +169,20 @@ export default class EventFullDate extends Vue {
|
|||||||
|
|
||||||
isSameDay(): boolean {
|
isSameDay(): boolean {
|
||||||
const sameDay =
|
const sameDay =
|
||||||
new Date(this.beginsOn).toDateString() ===
|
this.beginsOnDate.toDateString() === new Date(this.endsOn).toDateString();
|
||||||
new Date(this.endsOn).toDateString();
|
|
||||||
return this.endsOn !== undefined && sameDay;
|
return this.endsOn !== undefined && sameDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get beginsOnDate(): Date {
|
||||||
|
return new Date(this.beginsOn);
|
||||||
|
}
|
||||||
|
|
||||||
get differentFromUserTimezone(): boolean {
|
get differentFromUserTimezone(): boolean {
|
||||||
return (
|
return (
|
||||||
!!this.timezone &&
|
!!this.timezone &&
|
||||||
!!this.userActualTimezone &&
|
!!this.userActualTimezone &&
|
||||||
getTimezoneOffset(this.timezone) !==
|
getTimezoneOffset(this.timezone, this.beginsOnDate) !==
|
||||||
getTimezoneOffset(this.userActualTimezone) &&
|
getTimezoneOffset(this.userActualTimezone, this.beginsOnDate) &&
|
||||||
this.timezone !== this.userActualTimezone
|
this.timezone !== this.userActualTimezone
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1300,7 +1300,7 @@ export default class EditEvent extends Vue {
|
|||||||
tzOffset(date: Date): number {
|
tzOffset(date: Date): number {
|
||||||
if (this.timezone && date) {
|
if (this.timezone && date) {
|
||||||
const eventUTCOffset = getTimezoneOffset(this.timezone, date);
|
const eventUTCOffset = getTimezoneOffset(this.timezone, date);
|
||||||
const localUTCOffset = getTimezoneOffset(this.userActualTimezone);
|
const localUTCOffset = getTimezoneOffset(this.userActualTimezone, date);
|
||||||
return (eventUTCOffset - localUTCOffset) / (60 * 1000);
|
return (eventUTCOffset - localUTCOffset) / (60 * 1000);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user