Add X-Timezone header to all API requests

Send the device's IANA timezone identifier (e.g., "America/Los_Angeles")
with every API request to enable timezone-aware overdue task detection.

Platform implementations:
- Android/JVM: TimeZone.getDefault().id
- iOS: NSTimeZone.localTimeZone.name
- JS/WASM: Intl.DateTimeFormat().resolvedOptions().timeZone

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-13 00:04:44 -06:00
parent 258ccf7354
commit a3e1c338d2
6 changed files with 37 additions and 0 deletions

View File

@@ -15,6 +15,11 @@ actual fun getDeviceLanguage(): String {
return window.navigator.language.split("-").firstOrNull() ?: "en"
}
actual fun getDeviceTimezone(): String {
// Use Intl API to get IANA timezone name (e.g., "America/Los_Angeles")
return js("Intl.DateTimeFormat().resolvedOptions().timeZone") as String
}
actual fun createHttpClient(): HttpClient {
return HttpClient(Js) {
install(ContentNegotiation) {
@@ -32,6 +37,7 @@ actual fun createHttpClient(): HttpClient {
install(DefaultRequest) {
headers.append("Accept-Language", getDeviceLanguage())
headers.append("X-Timezone", getDeviceTimezone())
}
}
}