Skip to content

Commit

Permalink
switch back to using hour12 for IANA offset calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
icambron committed Nov 8, 2021
1 parent b5e3896 commit 1d43d46
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/zones/IANAZone.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let dtfCache = {};
function makeDTF(zone) {
if (!dtfCache[zone]) {
dtfCache[zone] = new Intl.DateTimeFormat("en-US", {
hourCycle: "h23",
hour12: false,
timeZone: zone,
year: "numeric",
month: "2-digit",
Expand Down Expand Up @@ -152,11 +152,14 @@ export default class IANAZone extends Zone {
? partsOffset(dtf, date)
: hackyOffset(dtf, date);

// because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat
const adjustedHour = hour === 24 ? 0 : hour;

const asUTC = objToLocalTS({
year,
month,
day,
hour,
hour: adjustedHour,
minute,
second,
millisecond: 0,
Expand Down

0 comments on commit 1d43d46

Please sign in to comment.