Skip to content

Commit

Permalink
💅 fix bug in DST calculation (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgravois authored Feb 8, 2025
1 parent 0f31066 commit b7d3145
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export const anotherTimeFormattingFunc = (val: string | null) => {
// 7 or 8 (from GMT) depending on the season
export const getPacificOffset = (rawDate: string) => {
const [year, month, day] = rawDate.split("-").map((val) => Number(val));
return new TZDate(year, month, day, "America/Los_Angeles").getTimezoneOffset() / 60;
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#monthindex
const monthIdx = month - 1
return new TZDate(year, monthIdx, day, "America/Los_Angeles").getTimezoneOffset() / 60;
}

export const getTimezoneOffsetMs = (date: Date) => {
Expand Down

0 comments on commit b7d3145

Please sign in to comment.