Skip to content

Commit

Permalink
workaround Chrome offset issue
Browse files Browse the repository at this point in the history
  • Loading branch information
icambron committed Nov 18, 2019
1 parent 9c3fad5 commit 63122c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions src/zones/IANAZone.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,20 @@ export default class IANAZone extends Zone {
dtf = makeDTF(this.name),
[year, month, day, hour, minute, second] = dtf.formatToParts
? partsOffset(dtf, date)
: hackyOffset(dtf, date);
const asUTC = objToLocalTS({ year, month, day, hour, minute, second, millisecond: 0 });
: hackyOffset(dtf, date),
// work around https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat
adjustedHour = hour === 24 ? 0 : hour;

const asUTC = objToLocalTS({
year,
month,
day,
hour: adjustedHour,
minute,
second,
millisecond: 0
});

let asTS = date.valueOf();
asTS -= asTS % 1000;
return (asUTC - asTS) / (60 * 1000);
Expand Down

0 comments on commit 63122c7

Please sign in to comment.