Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uppdated adjustTimezone to set date to GMT-0, #89

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
}
Loading