Skip to content

Standardize time & duration formatting with Settings toggle - #33

Merged
gsbernstein merged 2 commits into
masterfrom
cursor/duration-format-setting-12e9
Aug 6, 2026
Merged

Standardize time & duration formatting with Settings toggle#33
gsbernstein merged 2 commits into
masterfrom
cursor/duration-format-setting-12e9

Conversation

@gsbernstein

@gsbernstein gsbernstein commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

Makes clock times and durations consistent across Bedger.

  • Times of day always format as h:mm am/pm (e.g. 11:10 PM) via a shared TimeFormatter.formatTimeOfDay.
  • Durations default to compact hours/minutes (5h 6m), with a Settings → Display toggle for decimal hours (5.1h).
  • Sleep goals (quarter-hour steps) use up to two decimal places in decimal mode (7.25h, 8.5h, 8h); other durations stay at one decimal (5.1h).
  • Sleep Balance card uses equal-width columns so Status stays horizontally centered when Average/Goal string lengths differ (e.g. 6h 35m vs 7h).

Details

  • New DurationDisplayStyle + useDecimalDurations preference on UserPreferences, exposed through a SwiftUI environment value.
  • Replaced the old H:MM duration helper and scattered %.1f hours / locale .short time formatters.
  • Recommendation reason text and sleep-bank status copy respect the selected style.
  • Insight narratives still use natural language (2 hours 30 minutes) since they read as prose.

Verification

Cannot build or run in this Linux Cloud Agent environment (Xcode / SwiftUI / HealthKit are macOS-only). Please verify on a Mac with the Bedtime scheme.

Open in Web Open in Cursor 

cursoragent and others added 2 commits August 4, 2026 16:46
Clock times always use h:mm am/pm. Durations default to compact "5h 6m"
with a Settings toggle for decimal hours ("5.1h"), using up to two
decimals for quarter-hour sleep goals.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
Unequal Average/Goal string widths were shifting Status off-center;
give each column maxWidth infinity so the middle stays centered.

Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
@gsbernstein
gsbernstein marked this pull request as ready for review August 6, 2026 14:00
@gsbernstein
gsbernstein merged commit 90e7a23 into master Aug 6, 2026
2 checks passed
@gsbernstein
gsbernstein deleted the cursor/duration-format-setting-12e9 branch August 6, 2026 14:00
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