Skip to content

Commit

Permalink
Fix: incorrect date when ref timezone is unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
Wanasit Tanakitrungruang committed Nov 24, 2021
1 parent 82c75e3 commit 801ca4e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ export class ParsingComponents implements ParsedComponents {

private getSystemTimezoneAdjustmentMinute() {
const currentTimezoneOffset = -new Date().getTimezoneOffset();
const targetTimezoneOffset = this.get("timezoneOffset") ?? this.reference.timezoneOffset;
const targetTimezoneOffset =
this.get("timezoneOffset") ?? this.reference.timezoneOffset ?? currentTimezoneOffset;

return currentTimezoneOffset - targetTimezoneOffset;
}
Expand Down

0 comments on commit 801ca4e

Please sign in to comment.