Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Start and end of day incorrect for timezone #117
When i start ActivityWatch it shows the wrong day not that current day as its recording today's data for the 15th but its the 16th in Australia and on my computer clock.
What i think the problem is
The code that is recording the the Activity is using a USA data and code showing the page is using the Australia data/my computers data.
changed the title from
When started show the data for the wrong day.
When started shows the data for the wrong day.
Oct 15, 2017
Definitely! I thought we had fixed this, but apparently, it persists.
The data is likely logged correctly (we store everything in UTC). It's just the web UI that doesn't query the data correctly (for whatever reason doesn't take into account your timezone). I'll take a look at this.
This was referenced
Oct 16, 2017
This was not fixed. I did some digging and we seem to have slightly deeper problems, but a fix should be easy.
from datetime import datetime, timezone, timedelta import aw_client api = aw_client.ActivityWatchClient(testing=True) buckets = api.get_buckets() window_bid = next(bid for bid in buckets.keys() if "window" in bid and "testing" not in bid) print(window_bid) utcplus2h = timezone(timedelta(hours=2)) start = datetime(year=2017, month=10, day=27, hour=0, tzinfo=utcplus2h) end = start + timedelta(hours=24) events = api.get_events(window_bid, start=start, end=end, limit=-1) print(len(events)) print(events.timestamp) print(events[-1].timestamp)
This output is wrong since the first event should not be from 00:09 UTC, but rather from right after 22:00 UTC. I suspect we are missing a