04-27-2021 09:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-27-2021 09:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
It appears that the date doesn't change till 2am.
- Is this because of daylight savings synchronization?
- Is it because time zone is GMT +2?
- Is it for goal matching?
- Does it change when daylight savings is finished?
- Is it a bug?
For most people the date changes at midnight, is there some other reason why the Fitbit OS works to a different standard?
Author | ch, passion for improvement.

04-30-2021 06:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-30-2021 06:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Can you provide a bit more info? Which device and firmware version, and a small code snippet.
Thanks

04-30-2021 07:10 - edited 04-30-2021 07:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-30-2021 07:10 - edited 04-30-2021 07:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Sense - 44.128.4.17
clock.granularity = "seconds";
clock.ontick = (evt) => {
let today = evt.date;
let hours = today.getHours();
let mins = util.zeroPad(today.getMinutes());
let secs = util.zeroPad(today.getSeconds());
if (mins == 0 && secs == 0)
{
var newDay = new Date();
console.log(hours +" " +newDay.toDateString());
}
}
When hours = 2 the date changes.
Author | ch, passion for improvement.

04-30-2021 07:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-30-2021 07:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Yeah, so in Javascript the Date object is UTC.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
If you want the clock time, you should already have it in evt.date

04-30-2021 08:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-30-2021 08:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Unfortunately its in the setInterval so the evt.date is not available as it won't have been updated.
What do you recommend as an alternative?.
Author | ch, passion for improvement.

04-30-2021 10:05 - edited 04-30-2021 10:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-30-2021 10:05 - edited 04-30-2021 10:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Just did a test
let today = evt.date;
Console.log(today.toTimeString());
let myDay = new Date();
Console.log(myDay .toTimeString());
They print the same time. Why, if one is UTC and the other local.?
The .getTimezoneOffset() are also the same.
Author | ch, passion for improvement.

05-05-2021 00:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-05-2021 00:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
What it looks like is evt.date returns local date and hours and minutes, but new Date() returns UTC date and local hours and minutes.
Is that possible?
Author | ch, passion for improvement.

05-05-2021 00:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-05-2021 00:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I don't think that `new Date()` has a time zone (except inasmuch as it's the number of milliseconds since 1 January 1970 UTC). It depends how you use it.
Gondwana Software

05-05-2021 01:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-05-2021 01:06
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
True, then it must be a bug with .getDate() [not sure now that evt.date does actually return local date, as opposed to utc date].
Odd that it seems ok in the test in the OS simulator.
Will investigate further in real conditions on a watch.
Author | ch, passion for improvement.

05-07-2021 10:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-07-2021 10:03
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
It seems toDateString returns a UTC date and toString local time, both using the same date field !!!
Its the same with evt.date and new Date() in the simulator.
Author | ch, passion for improvement.
