Skip to content

fix(DateTimeUtils): preserve day of month in formatted times - #527

Open
SAY-5 wants to merge 1 commit into
airframesio:masterfrom
SAY-5:fix/473-day-of-month-formatting
Open

SAY-5 wants to merge 1 commit into
airframesio:masterfrom
SAY-5:fix/473-day-of-month-formatting

Conversation

@SAY-5

@SAY-5 SAY-5 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Day-and-time values now retain their encoded day when formatted, including day 31, without changing raw timestamps or time-only output. Fixes #473.

All 101 test suites pass (502 tests, 8 skipped) and npm run build passes; standalone TypeScript and source lint diagnostics are unchanged from master.

Summary by CodeRabbit

  • Bug Fixes
    • Timestamps shorter than 32 days now display the elapsed day number alongside the time, rather than a date derived from UTC conversion. This improves formatting when the month is unknown.
    • Improved coverage for timestamp formatting and day/time conversion cases.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: f050f49b-ba9c-480f-a17c-29ab95e69ee8

📥 Commits

Reviewing files that changed from the base of the PR and between 51c912e and 06f73d3.

📒 Files selected for processing (2)
  • lib/DateTimeUtils.test.ts
  • lib/DateTimeUtils.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

timestampToString now derives the day from elapsed whole days for timestamps below 32 days. Tests add timestamp formatting expectations and three convertDayTimeToTod cases.

Changes

Day and Time Formatting

Layer / File(s) Summary
Elapsed-day formatting and tests
lib/DateTimeUtils.ts, lib/DateTimeUtils.test.ts
For timestamps below 32 days, timestampToString derives the day from elapsed whole days. Tests cover the final second of a day, a full UTC timestamp, and three day/time inputs.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 06f73

The change preserves the encoded day for reachable day/time values while leaving date-based values on the calendar-formatting path. No material merge risk remains in the reviewed scope.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 06f73

Short-duration timestamps now display their encoded day correctly. The change affects formatted strings, not the raw timestamps, and no new security exposure was identified. Compatibility with consumers outside this repository has not been verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Within inspected production callers, the change reaches formatted time fields rather than raw timestamps or privilege-bearing operations. External consumer exposure remains unverified.

Trust Boundaries and Controls

  • observed — Inspected callers reject NaN before invoking the formatter; the changed method itself does not perform an identity or authority transition.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #473 requires correct day-of-month formatting for DDHHMMSS values, including day 1 and day 31, with round-trip test coverage. timestampToString now derives the unknown-month day from `Math.f…
Out of Scope Changes check ✅ Passed The reviewed changes are limited to DateTimeUtils.timestampToString and its tests. They directly support issue #473 by correcting day formatting and verifying boundary behavior. The tests for time-o…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving the day of month when formatting DateTimeUtils values.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the clock at night,
Then marks the day with numbers right.
The seconds hop; the hours chime,
The formatter keeps the day in line.
Three test cases join the scene,
And midnight leaves the display clean.

Comment @coderabbitai help to get the list of available commands.

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.

Bug: DateTimeUtils.convertDayTimeToTod is off-by-one (day 15 renders as day 16)

2 participants