-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite interface (v3.0) #47
Merged
Conversation
This file contains 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.
Dramatic overhaul of the parser and interface inspired by #42, the need to expose types (#38), and locale issues (#23).
Changes from 2.0:
Formatters are no longer constructed. Formatting is just a simple call.
Fixes: Is there any real need for the "create a formatter" mechanism? #42
Types are now exposed for the entire interface.
Closes Add "numfmt.d.ts" to package.json as types entry #38
nbsp option is now off by default. A non-breaking space is till used as the grouping separator in the default locale, so "13 203" should not linebreak.
formatColor()
now returnsnull
if pattern does not define a color. Previously it would default to "black".Fixes Consider indicating whether "black" color is explicitly specified or assigned as a default #40
locale has been fixed so that a pattern may correctly override a locale. The expected behaviour is to be able to provide a default locale and that formatters override it by modifiers.
Both en_US and en-US styles are now supported for locale tags.
Group sizing is now controlled by an option,
{ grouping: [ 3, 3 ] }
The formatter had remnants of behaviour from its ancestor which allowed defining group sizing in the format. In Excel,
#,##,##0
and#,##0
are equivalent but sizing is controlled via locale settings.Fixes Comma operator does not work correctly #48
dateToSerial()
no longer passes non-dates through. If it gets incompatible input (such as a number), anull
will be returned.nativeDate option has been removed. This affects two things:
dateFromSerial()
now always returns a date parts array ([ y, m, d, ... ]
).parseValue()
/parseDate()
can no longer return dates.If you need the old behaviour then here is a utility function that safely converts the output to a
Date
.