-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat: add support for lowercase localizable formats (l, ll, lll, llll) #546
Conversation
Thanks, will consider this PR. |
Thanks! |
Codecov Report
@@ Coverage Diff @@
## dev #546 +/- ##
===================================
Coverage 100% 100%
===================================
Files 151 152 +1
Lines 942 954 +12
Branches 123 127 +4
===================================
+ Hits 942 954 +12
Continue to review full report at Codecov.
|
It's not about the size of this plugin, but the size of all other locale files. If we introduce some more localizable formats, all the locale files will be updated and added these format. That's a huge increase in the total size of our locale files. That's why I'd like to keep this PR pending until more feature requests. |
I see your worry. However, in the case of moment, there's only a few like zh-cn and sv who set (some) of their own short localized formats. dayjs is well designed and this funcionality can be implemented easily with a plugin (and, for my case, I did just that). I just thought that, by having the current locale plugin with this capacity (hence the PR), it could ease the transition for those who, like me, are migrating from moment to dayjs. In any case, thank you for the reply and awesome work on dayjs! |
You are right, only a few have this. Is there a full list of locales that have lowercase localizable formats instead of checking every locale files on GitHub one by one? I'm willing to merge this if it's not that much. 😬 |
On moment/locale, doing a
It's a bit more than 10% (13 locales out of 127 total), but still not too many. That should represent roughly 46 new lines total. |
Great! |
Skipped locales (fi, he, lt) without (yet) a current format setting in dayjs
We should update the docs accordinglly |
Will do. Adding current locales as well as fixing current tests to contain those key additions. Noticed an issue with localizedFormats. Will keep in touch and open accordingly. |
Added fix. Will review and add the missing localized formats for fi, he, lt. |
Maybe we could update the |
Hopefully this will make the bundle smaller
Well thought @xxyuk, thanks! We managed to bring the package size down a notch 😄 |
Not sure, can codecov do this? |
I don't know about codecov. The only one I do know is bundlesize and it looks great! |
Oh I see, we already have such size limit tool during our CI build. You could find them in |
Maybe update doc here as well ? |
Done. I also took a dabble at the regex previously mentioned and managed to shave a few more bytes off of it. |
added tests for to cover .format() interpolation
## [1.8.12](v1.8.11...v1.8.12) (2019-04-02) ### Bug Fixes * Add .get API ([7318797](7318797)) * Add 79 locales ([#541](#541)) ([f75a125](f75a125)) * Add Calendar plugin ([d1b9cf9](d1b9cf9)) * Add isoWeeksInYear plugin ([2db8631](2db8631)) * Add Occitan (oc-lnc) locale file ([#551](#551)) ([c30b715](c30b715)) * Add plugin minMax to sopport .max .min ([2870a23](2870a23)) * Fix set Month Year error in last day of the month ([d058f4a](d058f4a)) * Update ko locale weekdaysShort ([#543](#543)) ([317fd3e](317fd3e)) * Update localizedFormat plugin to support lowercase localizable formats (l, ll, lll, llll) ([#546](#546)) ([f2b5ebf](f2b5ebf))
🎉 This PR is included in version 1.8.12 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [1.8.12](iamkun/dayjs@v1.8.11...v1.8.12) (2019-04-02) ### Bug Fixes * Add .get API ([7318797](iamkun/dayjs@7318797)) * Add 79 locales ([#541](iamkun/dayjs#541)) ([f75a125](iamkun/dayjs@f75a125)) * Add Calendar plugin ([d1b9cf9](iamkun/dayjs@d1b9cf9)) * Add isoWeeksInYear plugin ([2db8631](iamkun/dayjs@2db8631)) * Add Occitan (oc-lnc) locale file ([#551](iamkun/dayjs#551)) ([c30b715](iamkun/dayjs@c30b715)) * Add plugin minMax to sopport .max .min ([2870a23](iamkun/dayjs@2870a23)) * Fix set Month Year error in last day of the month ([d058f4a](iamkun/dayjs@d058f4a)) * Update ko locale weekdaysShort ([#543](iamkun/dayjs#543)) ([317fd3e](iamkun/dayjs@317fd3e)) * Update localizedFormat plugin to support lowercase localizable formats (l, ll, lll, llll) ([#546](iamkun/dayjs#546)) ([f2b5ebf](iamkun/dayjs@f2b5ebf))
## [1.8.12](iamkun/dayjs@v1.8.11...v1.8.12) (2019-04-02) ### Bug Fixes * Add .get API ([7318797](iamkun/dayjs@7318797)) * Add 79 locales ([#541](iamkun/dayjs#541)) ([f75a125](iamkun/dayjs@f75a125)) * Add Calendar plugin ([d1b9cf9](iamkun/dayjs@d1b9cf9)) * Add isoWeeksInYear plugin ([2db8631](iamkun/dayjs@2db8631)) * Add Occitan (oc-lnc) locale file ([#551](iamkun/dayjs#551)) ([c30b715](iamkun/dayjs@c30b715)) * Add plugin minMax to sopport .max .min ([2870a23](iamkun/dayjs@2870a23)) * Fix set Month Year error in last day of the month ([d058f4a](iamkun/dayjs@d058f4a)) * Update ko locale weekdaysShort ([#543](iamkun/dayjs#543)) ([317fd3e](iamkun/dayjs@317fd3e)) * Update localizedFormat plugin to support lowercase localizable formats (l, ll, lll, llll) ([#546](iamkun/dayjs#546)) ([f2b5ebf](iamkun/dayjs@f2b5ebf))
## [1.8.12](iamkun/dayjs@v1.8.11...v1.8.12) (2019-04-02) ### Bug Fixes * Add .get API ([7318797](iamkun/dayjs@7318797)) * Add 79 locales ([#541](iamkun/dayjs#541)) ([f75a125](iamkun/dayjs@f75a125)) * Add Calendar plugin ([d1b9cf9](iamkun/dayjs@d1b9cf9)) * Add isoWeeksInYear plugin ([2db8631](iamkun/dayjs@2db8631)) * Add Occitan (oc-lnc) locale file ([#551](iamkun/dayjs#551)) ([c30b715](iamkun/dayjs@c30b715)) * Add plugin minMax to sopport .max .min ([2870a23](iamkun/dayjs@2870a23)) * Fix set Month Year error in last day of the month ([d058f4a](iamkun/dayjs@d058f4a)) * Update ko locale weekdaysShort ([#543](iamkun/dayjs#543)) ([317fd3e](iamkun/dayjs@317fd3e)) * Update localizedFormat plugin to support lowercase localizable formats (l, ll, lll, llll) ([#546](iamkun/dayjs#546)) ([f2b5ebf](iamkun/dayjs@f2b5ebf))
This PR tries to bridge the gap between dayjs and moment by implementing lowecase/short localizable formats, already present in moment, since 2.0.0