metaflowltd / flutter_health_fit

A flutter plugin for using Apple HealthKit and Google Fit.
Other
86 stars 31 forks source link

[Question] Is DateTime is UTC or Local? #88

Closed mirkancal closed 1 year ago

mirkancal commented 1 year ago

As you know, the date comes as a String without timezone. I always assumed is local but I see some inconsistencies in DB. Is the date I'm receiving from the steps data in UTC or a Local Date?

Thanks in advance.

rtokun commented 1 year ago

The data of steps or any other datapoint does include dates, but it is returned as epoch in milliseconds not as string representation of the Date. So basically it is in UTC.

mirkancal commented 1 year ago

@rtokun thanks, seems like data is returning based on the user's time zone, so SDK handles based on the request.

For example if I put 5K Steps on 15 December 1 AM in GMT+4, when my timezone is GMT+1 on the emulator, it puts that 5K Steps to 14 December.