Date-formatters: do not import @wordpress/date #47812
Date-formatters: do not import @wordpress/date #47812
@wordpress/date #47812Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
@wordpress/data
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
|
Note that, with the previous method of including With this change, |
@wordpress/data @wordpress/date
Wow that's a great observation. I'll check if I can make |
|
Some of the documentation at https://momentjs.com/docs/#/-project-status/ may help. 😉 |
|
@anomiex I sent a PR to GB here, but it seems like this will take a long time to be usable as a package, at least two weeks until GB is released. WDYT about this? |
34dfb1a to
097a19d
Compare
Hacky. It should work though. |
rcrdortiz
left a comment
There was a problem hiding this comment.
LGTM, thanks for these changes!
Fixes DOTCOM-16527
Proposed changes
number-formattersimported@wordpress/datewhich importsmomententirely. Butnumber-formattersonly needs the settings from@wordpress/datewhich are available as a global anyway. This change makes it so we access the settings directly without dragging all the JS dependencies of@wordpress/datejust to get the locale. This saves us 75KB minified and gzipped.Other information
Related product discussion/links
https://linear.app/a8c/project/mobile-nux-performance-improvements-386901dd9438/overview
Does this pull request change what data or activity we track or use?
No.
Testing instructions
I'm not sure how to test this library, but you can test the change by going to the editor
/wp-admin/post-new.php, opening DevTools > Console, and runningwindow.wp?.date?.getSettings?.()?.l10n?.locale.