Fixed clock-change date ranges and blocks displayed at the wrong hour - #13
Merged
Merged
Conversation
…times without a zone * TimeUtils.makeEndOfDay_12AM() adds a calendar day instead of 24 hours. It sets the end of the date range in the billing exports and the scheduled-time pages. For an end date on a clock-change Sunday it returned 1 AM or 11 PM instead of midnight. * JSONInstrumentUsageGetter sends block start and end times to the calendar as yyyy-MM-dd'T'HH:mm:ss instead of Date.toString(). A browser outside Pacific time displayed blocks at a different hour than their labels. * Documented that UsageBlockBase.getHours() counts elapsed hours, one less or more than the clock times across a daylight saving change. * Removed the commented-out TimeUtils.makeEndOfDay(). * Added UsageBlockBaseTest, TimeUtilsTest and JSONInstrumentUsageGetterTest. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The DST fixes are correct, focused, and covered by representative regression tests.
Pull request overview
Corrects DST-related date boundaries and scheduler calendar rendering while preserving elapsed-hour billing behavior.
Changes:
- Advances end dates by one calendar day instead of 24 hours.
- Emits timezone-free ISO calendar event timestamps.
- Documents and tests elapsed-hour calculations across DST transitions.
File summaries
| File | Description |
|---|---|
TimeUtils.java |
Fixes end-of-day calculation across DST changes. |
TimeUtilsTest.java |
Tests ordinary and DST boundary dates. |
JSONInstrumentUsageGetter.java |
Formats calendar events as local ISO timestamps. |
JSONInstrumentUsageGetterTest.java |
Tests event formatting across server time zones. |
UsageBlockBase.java |
Documents elapsed-hour semantics. |
UsageBlockBaseTest.java |
Tests hour totals across DST transitions. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
end date. For an end date on a clock-change Sunday the range ended at 1 AM or 11 PM instead.
hours shown in their tooltips whatever the browser's time zone. With the old Date.toString() times,
a browser outside Pacific time displayed each block at a different hour.
counts one hour less or more than its clock times. UsageBlockBase.getHours() now documents this, and
a test records it.
Test plan
calculation and the old Date.toString() event times
forward and 9 across fall back
2025-10-31T10:00:00 and 2025-11-02T04:00:00, the block reads "10a - 4a", its tooltip matches, and in
week view it ends at the 4am line on Sunday 11/2. A browser set to Eastern time shows the same hours,
where the old format would have shown 1p - 7a
Co-Authored-By: Claude noreply@anthropic.com