Skip to content
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

Cache DateTimeFormatter instances #4148

Closed
jcfranco opened this issue Feb 18, 2022 · 3 comments
Closed

Cache DateTimeFormatter instances #4148

jcfranco opened this issue Feb 18, 2022 · 3 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. estimate - 2 Small fix or update, may require updates to tests. refactor Issues tied to code that needs to be significantly reworked.

Comments

@jcfranco
Copy link
Member

Description

Currently, the time util will create multiple Intl.DateTimeFormatter instances for the same locale. This can be improved by reusing one for the same locale.

Proposed Advantages

Less instances generated for the same locale.

Which Component

src/utils/time.ts

Relevant Info

No response

@jcfranco jcfranco added refactor Issues tied to code that needs to be significantly reworked. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Feb 18, 2022
@jcfranco jcfranco self-assigned this Apr 3, 2023
@jcfranco jcfranco added estimate - 2 Small fix or update, may require updates to tests. 2 - in development Issues that are actively being worked on. and removed needs triage Planning workflow - pending design/dev review. 0 - new New issues that need assignment. labels Apr 3, 2023
@jcfranco
Copy link
Member Author

jcfranco commented Apr 3, 2023

Moving to the April milestone as this will be needed for #5570. cc @brittneytewks @geospatialem

jcfranco added a commit that referenced this issue Apr 3, 2023
**Related Issue:** #4148 

## Summary

Adds util to reuse `Intl.DateTimeFormat` instances.

This came up while working on
#5570 and decided to
submit separately to link to #4148.

## Notes

* caching will be tied to single locale, once it changes, the cache will
be cleared
* this removes error handling in `time.ts` when creating a
`Intl.DateTimeFormat` as specifying an unsupported locale would be a
user error.
@jcfranco jcfranco added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Apr 3, 2023
@github-actions github-actions bot assigned geospatialem and unassigned jcfranco Apr 3, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 3, 2023

Installed and assigned for verification.

@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Apr 11, 2023
@geospatialem
Copy link
Member

Verified on master when changing locales.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. estimate - 2 Small fix or update, may require updates to tests. refactor Issues tied to code that needs to be significantly reworked.
Projects
None yet
Development

No branches or pull requests

3 participants