Skip to content

Add minDecimals to output of getFormatInfo() - #79

Merged
borgar merged 2 commits into
borgar:masterfrom
yelper:dev/alsarika/add-min-decimals-info
Sep 9, 2026
Merged

borgar merged 2 commits into
borgar:masterfrom
yelper:dev/alsarika/add-min-decimals-info

Conversation

@yelper

@yelper yelper commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

I found that when I was trying to use getFormatInfo() to get metadata about formats that "0.0" and "0.#", the info function returned the exact same FormatInfo objects.

To differentiate them, I thought it was natural to support a minDecimals property as part of FormatInfo. This PR adds the ability to return this metadata.

Supporting something like minDecimals would help pass correct downstream information to other functionality, like compaction of numbers using something like Intl.NumberFormat, setting minimumFractionDigits and maximumFractionDigits (see MDN).

AI note: I used GPT 5.4 Sol to initially author the PR, but then personally reviewed all code/doc changes.

@borgar

borgar commented Sep 3, 2026

Copy link
Copy Markdown
Owner

I like the change but I'm doing a TS rewrite so I've just created major conflicts on this branch. Sorry about that. You'll need to update this patch against the new code.

I'd prefer if you didn't include build results (API.md or dist/*) in the PR; they will get produced when a release happens.

@yelper

yelper commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Will do! No worries about conflicts, I'm happy to resolve.

@yelper
yelper force-pushed the dev/alsarika/add-min-decimals-info branch from afb9488 to 6fda0a2 Compare September 4, 2026 22:25
@yelper

yelper commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Updated to match refactor!

@borgar
borgar merged commit 186cd92 into borgar:master Sep 9, 2026
3 checks passed
@borgar

borgar commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Thanks for this. As you can tell, I'm working on a major release which will include this and will be out as soon as I've cleaned up some warts in the locales. 🙂

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