Apple Health & timezones: what we know and current limitations #606
bartmichalak
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Context
We need timezone information to correctly interpret when health events (e.g. sleep) happen in the user's local time. This discussion documents what we've learned about how Apple Health handles timezones.
Key Facts
1. Apple Health stores everything in UTC
There is no timezone offset attached to standard health records.
2.
HKMetadataKeyTimeZoneexists but is mostly nullApple Health has a metadata field
HKMetadataKeyTimeZone- but in practice:Based on a full sync test: out of 2026 sleep records, only 2 were missing timezone (both manually added). For workouts, 5 out of 19 had timezone - all from Apple Watch.
Ref: Stack Overflow - HKMetadataKeyTimeZone is always nil
3. Current device timezone is not a reliable fallback
We decided not to fall back to the current device timezone because it would falsify historical data - the user may have been in a different timezone when the data was recorded.
4. Open questions
Beta Was this translation helpful? Give feedback.
All reactions