My understanding is that a Moment represents a UTC timestamp, and Gregorian.info() will apply the local timezone to the Moment as part of its formatting. So far so reasonable :-)
But ActivityMonitor.History.startOfDay seems to behave rather oddly, given the above.
The activity counter rolls over at local midnight. But the startOfDay Moment seems to represent either the time midnight occurred in the UTC timezone in UTC terms, or the local midnight in local terms. (Both cases are identical.)
Therefore when Gregorian.info() applies the timezone offset it's correcting for something which has already been corrected for, and if you're in the western hemisphere, you end up with the wrong day (the previous one).
I'm correcting this here: https://github.com/simonmacmullen/activity-widget/blob/e0fd32c4a6ab669e5a43cf1c8e43946c7ba3e7c7/src/ActivityWidgetView.mc#L133 but to me this smells like a bug. Am I missing something or is this intentional? (And if it's intentional can it please be documented?)