Skip to content

Commit

Permalink
Merge pull request #89 from armada-ths/august/hotfix
Browse files Browse the repository at this point in the history
uppdated adjustTimezone to set date to GMT-0,
  • Loading branch information
hampfh authored Sep 12, 2024
2 parents 180b78f + 4f7e3ca commit 5c62fe5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ export function formatTimestampAsTime(epochSeconds: number) {
}

/**
* There is something weird going on with the ais timestamp,
* making luxon think we're in the wrong timezone, this way
* we force it to be sweden specific.
* The AIS API gives us dates in Epoch timestamp for GMT-0 without timezone info
* If someone sets a time for a event as 17, it will be stored as 19 in the AIS
* This functions adds the context of the timezone back
*/
function adjustTimezone(date: DateTime) {
if (date.setZone("Europe/Stockholm").isInDST) return date.setZone("UTC-2")
return date.setZone("UTC-1")
return date.setZone("UTC-0")
}

0 comments on commit 5c62fe5

Please sign in to comment.