Skip to content

Fixed clock-change date ranges and blocks displayed at the wrong hour - #13

Merged
vagisha merged 1 commit into
masterfrom
dst-handling
Sep 17, 2026
Merged

vagisha merged 1 commit into
masterfrom
dst-handling

Conversation

@vagisha

@vagisha vagisha commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The billing exports and the scheduled-time pages end their date range at midnight after the chosen
    end date. For an end date on a clock-change Sunday the range ended at 1 AM or 11 PM instead.
  • The scheduler calendar receives block times without a time zone, so it displays them at the Pacific
    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.
  • Billed and quota hours are unchanged. They count elapsed hours, so a block across a clock change
    counts one hour less or more than its clock times. UsageBlockBase.getHours() now documents this, and
    a test records it.

Test plan

  • TimeUtilsTest and JSONInstrumentUsageGetterTest pass, and fail against the old end-of-day
    calculation and the old Date.toString() event times
  • UsageBlockBaseTest passes. 10 PM to 6 AM counts 8 hours with no clock change, 7 across spring
    forward and 9 across fall back
  • On a rebuilt war, the Lumos calendar for project 510 in November 2025: the feed sends
    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

…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>
@vagisha vagisha changed the title Fixed date ranges ending on a clock-change day, and showed calendar blocks at Pacific times in any time zone Fixed clock-change date ranges and blocks displayed at the wrong hour Sep 17, 2026
@vagisha
vagisha requested a balanced review from Copilot September 17, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

@vagisha
vagisha merged commit 88fcb1f into master Sep 17, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants