Repository navigation
fix: truncate hours in countdowns instead of rounding them - #2
Open
knightmare2600 wants to merge 1 commit into
Open
knightmare2600 wants to merge 1 commit into
knightmare2600 wants to merge 1 commit into
Conversation
PowerShell's [int] cast rounds to nearest, so a TimeSpan of 7h36m (TotalHours 7.6) was formatted as "08:36:00". Use [math]::Floor for the hours component in all five countdown formatters: pre-market, lunch break, closing, the DataGrid countdown column and the status-bar next-close countdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 9, 2026
This branch has not been deployed
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
Countdowns rounded the hours component instead of truncating it, so they could be an hour too high.
The bug
[int]$TimeSpan.TotalHours. PowerShell's[int]cast rounds to nearest (ties to even); it does not truncate. Reproduction:TotalHours= 7.6) was displayed as08:36:00.The fix
[int][math]::Floor($TimeSpan.TotalHours)in all five countdown formatters:Format-RelativeTime) is not a countdown and is left as is.Interaction with other PRs
#5 (Nasdaq Copenhagen) moves these same lines into a shared
Format-CountdownSpanhelper that also truncates. If both are merged, the second one conflicts on these lines — keep #5's version.Checks
Lintworkflow already fails onmainbefore this change — PSScriptAnalyzer reports 120 Warning-level findings there (e.g. run 36486962685). This PR adds no new findings (compared by rule, file and message againstmain), so a red Lint check here is the pre-existing state.[Unreleased]. The PRs in this series are independent where possible, so whichever merges second will have a trivial conflict in that section — keep both entries.This is one of a series of small PRs (fixes and features kept separate so you can pick and choose): #2 countdown hours · #3 Refresh button · #4 map preferences · #5 Nasdaq Copenhagen · #6 OMXC25 · #7 FX DKK/SEK · #8 København clock · #9 FTSE 100 · #10 ETF labels.
🤖 Generated with Claude Code