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

Data appears twice with bucket=day and daylights saving time switch #121

Open
marcovtwout opened this issue Oct 2, 2018 · 11 comments
Open

Comments

@marcovtwout
Copy link

On the 28th of October 2018, in timezone with Daylight Savings Time clock reverses one hour.

With the following request (made from GMT+1):

let options = <HealthQueryOptionsAggregated> {
          startDate: '2018-10-01'
          endDate: '2018-11-01'
          dataType: 'steps',
          bucket: 'day',
          filtered: true,
};

let data = this.health.queryAggregated(options);

The entry for the 28th of October appears twice in the data:

[..]
25: {startDate: Sat Oct 27 2018 00:00:00 GMT+0200 (Midden-Europese zomertijd), endDate: Sun Oct 28 2018 00:00:00 GMT+0200 (Midden-Europese zomertijd), value: 0, unit: "count"}
26: {startDate: Sun Oct 28 2018 00:00:00 GMT+0200 (Midden-Europese zomertijd), endDate: Sun Oct 28 2018 23:00:00 GMT+0100 (Midden-Europese standaardtijd), value: 0, unit: "count"}
27: {startDate: Sun Oct 28 2018 23:00:00 GMT+0100 (Midden-Europese standaardtijd), endDate: Mon Oct 29 2018 23:00:00 GMT+0100 (Midden-Europese standaardtijd), value: 0, unit: "count"}
28: {startDate: Mon Oct 29 2018 23:00:00 GMT+0100 (Midden-Europese standaardtijd), endDate: Tue Oct 30 2018 23:00:00 GMT+0100 (Midden-Europese standaardtijd), value: 0, unit: "count"}
[..]
@ghost
Copy link

ghost commented Oct 2, 2018

this is a good one.

iOS or Android?

@marcovtwout
Copy link
Author

Reproduced on multiple Android devices (5.1 and 8.0). Not a problem on iPhone.

@ghost
Copy link

ghost commented Oct 2, 2018

looks like a bug in the Google Fit APIs.
The bucketing on days is done by Fit: builder.bucketByTime(1, TimeUnit.DAYS);
there's not very much I can do I'm afraid...

@marcovtwout
Copy link
Author

Do you have access to the Google Fit development forum to escalate the bug report? https://plus.google.com/communities/103314459667402704958/stream/fde8d115-2bd4-4de0-b523-7a8ea7719ef7 (not sure this is official)

@dariosalvi78
Copy link
Owner

I've posted there sometimes, not really useful, but I can try...

@dariosalvi78
Copy link
Owner

Let's see if they reply:

https://plus.google.com/+DarioSalvi/posts/KX6dawXgfKW

@marcovtwout
Copy link
Author

Seems like it's not active, and I can't find any other place to report it. Thanks for posting anyways :)

@ghost
Copy link

ghost commented Oct 3, 2018

if Google doesn't solve it, you may develop a dedup() function yourself and take the first of the two instances. The second instance should contain no data: look at the start and end timestamps.

@marcovtwout
Copy link
Author

On closer inspection we can't just discard the second instance and splitting correctly afterwards will be impossible. Each bucket still spans a 24 hour period, the buckets after the DST switch are simply offset by one hour.

@marcovtwout
Copy link
Author

Just FYI, the same offset will occur when quering data around the 24th of march 2018 (wintertime to summertime):

[..]
4: {startDate: Sat Mar 24 2018 00:00:00 GMT+0100 (Central European Standard Time), endDate: Sun Mar 25 2018 00:00:00 GMT+0100 (Central European Standard Time), value: 1823, unit: "count"}
5: {startDate: Sun Mar 25 2018 00:00:00 GMT+0100 (Central European Standard Time), endDate: Mon Mar 26 2018 01:00:00 GMT+0200 (Central European Summer Time), value: 2130, unit: "count"}
6: {startDate: Mon Mar 26 2018 01:00:00 GMT+0200 (Central European Summer Time), endDate: Tue Mar 27 2018 01:00:00 GMT+0200 (Central European Summer Time), value: 3275, unit: "count"}
7: {startDate: Tue Mar 27 2018 01:00:00 GMT+0200 (Central European Summer Time), endDate: Wed Mar 28 2018 01:00:00 GMT+0200 (Central European Summer Time), value: 4952, unit: "count"}
[..]

@dariosalvi78
Copy link
Owner

thanks for checking, it confirms the behaviour then...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants