-
Notifications
You must be signed in to change notification settings - Fork 740
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
Add Interval.toLocaleString() #1320
Merged
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
This method is like DateTime.toLocaleString() but for intervals. It takes the same arguments. It uses the native DateTimeFormat.formatRange() method, now well supported by browsers.
Yeah, this is great. Last I'd looked at this, This will go in 3.2.0 |
Thanks for contributing! |
🙂 Thanks for Luxon! |
brboi
added a commit
to odoo-dev/odoo
that referenced
this pull request
Aug 30, 2023
**Changelog** **3.4.2 (2023-08-26)** - Fixes regression from 3.4.1 (moment/luxon#1493) **3.4.1 (2023-08-23)** - Fixes for regressions from 3.4.0 (moment/luxon#1482 and moment/luxon#1488) **3.4.0 (2023-08-08)** - Fix type checking on input zones - Fix Islamic months listing - Fix normalize() for negative inputs **3.3.0 (2023-03-03)** - Fix off-by-one in Interval#count (moment/luxon#1308) - Support formatting for custom zones (moment/luxon#1377) - Fix parsing for narrow spaces (moment/luxon#1369) - Handle leap year issue with AD 100 (moment/luxon#1390) - Allow parsing of just an offset **3.2.1 (2023-01-04)** - Fix for RFC-2822 regex vulnerability - Better handling of BCP tags with -x- extensions **3.2.0 (2022-12-29)** - Allow timeZone to be specified as an intl option - Fix for diff's handling of end-of-month when crossing leap years (moment/luxon#1340) - Add Interval.toLocaleString() (moment/luxon#1320) **3.1.1 (2022-11-28)** - Add Settings.twoDigitCutoffYear **3.1.0 (2022-10-31)** - Add Duration.rescale **3.0.4 (2022-09-24)** - Fix quarters in diffs (moment/luxon#1279) - Export package.json in package (moment/luxon#1239) **3.0.2 (2022-08-28)** - Lots of doc changes - Added DateTime.expandFormat - Added support for custom conversion matrices in Durations
robodoo
pushed a commit
to odoo/odoo
that referenced
this pull request
Sep 4, 2023
**Changelog** **3.4.2 (2023-08-26)** - Fixes regression from 3.4.1 (moment/luxon#1493) **3.4.1 (2023-08-23)** - Fixes for regressions from 3.4.0 (moment/luxon#1482 and moment/luxon#1488) **3.4.0 (2023-08-08)** - Fix type checking on input zones - Fix Islamic months listing - Fix normalize() for negative inputs **3.3.0 (2023-03-03)** - Fix off-by-one in Interval#count (moment/luxon#1308) - Support formatting for custom zones (moment/luxon#1377) - Fix parsing for narrow spaces (moment/luxon#1369) - Handle leap year issue with AD 100 (moment/luxon#1390) - Allow parsing of just an offset **3.2.1 (2023-01-04)** - Fix for RFC-2822 regex vulnerability - Better handling of BCP tags with -x- extensions **3.2.0 (2022-12-29)** - Allow timeZone to be specified as an intl option - Fix for diff's handling of end-of-month when crossing leap years (moment/luxon#1340) - Add Interval.toLocaleString() (moment/luxon#1320) **3.1.1 (2022-11-28)** - Add Settings.twoDigitCutoffYear **3.1.0 (2022-10-31)** - Add Duration.rescale **3.0.4 (2022-09-24)** - Fix quarters in diffs (moment/luxon#1279) - Export package.json in package (moment/luxon#1239) **3.0.2 (2022-08-28)** - Lots of doc changes - Added DateTime.expandFormat - Added support for custom conversion matrices in Durations closes #133599 Related: odoo/enterprise#46556 Signed-off-by: Luca Vitali (luvi) <[email protected]>
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.
Hi,
Interval.toLocaleString(formatOpts, opts)
works likeDateTime.toLocaleString(formatOpts, opts)
. Example:It relies on
Intl.DateTimeFormat.formatRange()
, now well supported by browsers.Partly closes luxon/issues#1237 (I can add
toLocaleParts
in this PR or a different one). Closes luxon/issues#691.