Repository navigation
Conversation
- Negative fractions no longer get two minus signs: formatFraction now formats the magnitude only and formatValue adds the sign. - Times are rounded to the smallest unit shown (seconds, or the digits of ".0") before being split into fields, as TEXT() already does. - An empty third section shows zero as an empty string. The section choice is shared with TEXT() through pickSection, which had the same fallback to the first section. - [hh], [mm] and [ss] are padded to their width. - Fixed decimals round the 15-digit decimal value with roundHalf instead of calling toFixed on the raw double (2.675 -> 2.68). Fixes #3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This fixes five places where
formatValueinsrc/core/xlsx/numfmt.tsgave different results from Excel. Each repro from the issue now has a test.Negative fractions no longer get two minus signs.
formatFractionformats only the magnitude andformatValueadds the sign, so -1.5 with# ?/?gives-1 1/2.Times are rounded to the smallest unit the format shows (whole seconds, or the digits after
.0) before being split into hours, minutes and seconds, the wayTEXT()informula/dates.tsalready does. 0.00001 withh:mm:ssgives0:00:01and 0.12345 withmm:ss.0gives57:46.1.An empty third section now shows zero as an empty string, so
0;-0;;@on 0 gives an empty string.TEXT()informula/format.tshad the same fallback to the first section; both now use one helper,pickSection, which sits next toroundHalf.[hh],[mm]and[ss]are padded to their width, so[mm]:sson 0.001 gives01:26.Fixed decimals are rounded with the existing
roundHalf, which rounds the 15-significant-digit decimal value, instead oftoFixedon the raw double. 2.675 and 1.005 with0.00now give2.68and1.01.Fixes #3
🤖 Generated with Claude Code