Set request timezone to match browser

This commit is contained in:
Kevin McConnell
2025-01-27 14:16:15 +00:00
parent 85daf2aecf
commit 94b2c256b9
4 changed files with 31 additions and 2 deletions
@@ -0,0 +1,12 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
connect() {
this.#setTimezoneCookie()
}
#setTimezoneCookie() {
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
document.cookie = `timezone=${encodeURIComponent(timezone)}; path=/`
}
}