-
-
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
Add locales for relativeTime and formats from momentjs #560
Conversation
dd65877
to
929b065
Compare
Codecov Report
@@ Coverage Diff @@
## dev #560 +/- ##
===================================
Coverage 100% 100%
===================================
Files 153 153
Lines 957 957
Branches 127 127
===================================
Hits 957 957
Continue to review full report at Codecov.
|
Looks great! |
@xxyuk Sure: https://gist.github.com/aadityataparia/2972c69ae5a11bbbbe1f07bd69847a86 Also Tests are failing for:
|
Perfect ~ |
@iamkun Does relativeTimePlugin supports functions? if yes maybe we can import simple functions. |
@aadityataparia Not yet. But we could do this. |
@iamkun For now, should I remove |
Yes, please. Still, we could add these later. |
3e277d9
to
c23b6be
Compare
2627c12
to
fc65da5
Compare
@iamkun Done, all tests are passing now. |
.gitignore
Outdated
@@ -13,7 +13,8 @@ package-lock.json | |||
coverage | |||
|
|||
# build | |||
/locale | |||
/locale* | |||
/moment* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry! Removing
fc65da5
to
fd226f0
Compare
@@ -53,7 +53,10 @@ it('Uses English formats in other locales as default', () => { | |||
const actualDate = dayjs(date) | |||
const expectedDate = moment(date) | |||
// todo: ar here isn't a good fix here | |||
const arOldFormats = ar.formats |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, @iamkun Any alternatives?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, I'll deal with this later.
@iamkun any timeline on when this will be merged? 🤔 |
next release 😬 |
aadityataparia 's solution looks great 😀 |
## [1.8.13](v1.8.12...v1.8.13) (2019-04-26) ### Bug Fixes * Add missing relativeTime and formats for some locales ([#560](#560)) ([96b917e](96b917e)) * Add weekday (locale aware day of the week) plugin ([#569](#569)) ([9007cc5](9007cc5)), closes [#559](#559) * Allow customizing "am" / "pm" strings with locale meridiem function ([#580](#580)) ([576e93e](576e93e)), closes [#578](#578) * Fix `.add` day/week decimal rouding bug ([800f6c9](800f6c9)) * Fix `.diff` type definition error ([#565](#565)) ([c4921ae](c4921ae)), closes [#561](#561) * Fix CustomParseFormat plugin bug ([#568](#568)) ([1f5a9db](1f5a9db)), closes [#555](#555) * Fix relativeTime plugin Math.round bug ([40bea40](40bea40)) * skip square brackets in buddhistEra, advancedFormat plugins ([#556](#556)) ([9279718](9279718)), closes [#554](#554) * Update Indonesian locale([#574](#574)) ([0aa7143](0aa7143)) * Update locale month to support both array and function ([#581](#581)) ([b6599d3](b6599d3)) * Update LocalizedFormat plugin lowercase formats logic ([#557](#557)) ([d409304](d409304))
🎉 This PR is included in version 1.8.13 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [1.8.13](iamkun/dayjs@v1.8.12...v1.8.13) (2019-04-26) ### Bug Fixes * Add missing relativeTime and formats for some locales ([#560](iamkun/dayjs#560)) ([96b917e](iamkun/dayjs@96b917e)) * Add weekday (locale aware day of the week) plugin ([#569](iamkun/dayjs#569)) ([9007cc5](iamkun/dayjs@9007cc5)), closes [#559](iamkun/dayjs#559) * Allow customizing "am" / "pm" strings with locale meridiem function ([#580](iamkun/dayjs#580)) ([576e93e](iamkun/dayjs@576e93e)), closes [#578](iamkun/dayjs#578) * Fix `.add` day/week decimal rouding bug ([800f6c9](iamkun/dayjs@800f6c9)) * Fix `.diff` type definition error ([#565](iamkun/dayjs#565)) ([c4921ae](iamkun/dayjs@c4921ae)), closes [#561](iamkun/dayjs#561) * Fix CustomParseFormat plugin bug ([#568](iamkun/dayjs#568)) ([1f5a9db](iamkun/dayjs@1f5a9db)), closes [#555](iamkun/dayjs#555) * Fix relativeTime plugin Math.round bug ([40bea40](iamkun/dayjs@40bea40)) * skip square brackets in buddhistEra, advancedFormat plugins ([#556](iamkun/dayjs#556)) ([9279718](iamkun/dayjs@9279718)), closes [#554](iamkun/dayjs#554) * Update Indonesian locale([#574](iamkun/dayjs#574)) ([0aa7143](iamkun/dayjs@0aa7143)) * Update locale month to support both array and function ([#581](iamkun/dayjs#581)) ([b6599d3](iamkun/dayjs@b6599d3)) * Update LocalizedFormat plugin lowercase formats logic ([#557](iamkun/dayjs#557)) ([d409304](iamkun/dayjs@d409304))
## [1.8.13](iamkun/dayjs@v1.8.12...v1.8.13) (2019-04-26) ### Bug Fixes * Add missing relativeTime and formats for some locales ([#560](iamkun/dayjs#560)) ([96b917e](iamkun/dayjs@96b917e)) * Add weekday (locale aware day of the week) plugin ([#569](iamkun/dayjs#569)) ([9007cc5](iamkun/dayjs@9007cc5)), closes [#559](iamkun/dayjs#559) * Allow customizing "am" / "pm" strings with locale meridiem function ([#580](iamkun/dayjs#580)) ([576e93e](iamkun/dayjs@576e93e)), closes [#578](iamkun/dayjs#578) * Fix `.add` day/week decimal rouding bug ([800f6c9](iamkun/dayjs@800f6c9)) * Fix `.diff` type definition error ([#565](iamkun/dayjs#565)) ([c4921ae](iamkun/dayjs@c4921ae)), closes [#561](iamkun/dayjs#561) * Fix CustomParseFormat plugin bug ([#568](iamkun/dayjs#568)) ([1f5a9db](iamkun/dayjs@1f5a9db)), closes [#555](iamkun/dayjs#555) * Fix relativeTime plugin Math.round bug ([40bea40](iamkun/dayjs@40bea40)) * skip square brackets in buddhistEra, advancedFormat plugins ([#556](iamkun/dayjs#556)) ([9279718](iamkun/dayjs@9279718)), closes [#554](iamkun/dayjs#554) * Update Indonesian locale([#574](iamkun/dayjs#574)) ([0aa7143](iamkun/dayjs@0aa7143)) * Update locale month to support both array and function ([#581](iamkun/dayjs#581)) ([b6599d3](iamkun/dayjs@b6599d3)) * Update LocalizedFormat plugin lowercase formats logic ([#557](iamkun/dayjs#557)) ([d409304](iamkun/dayjs@d409304))
## [1.8.13](iamkun/dayjs@v1.8.12...v1.8.13) (2019-04-26) ### Bug Fixes * Add missing relativeTime and formats for some locales ([#560](iamkun/dayjs#560)) ([96b917e](iamkun/dayjs@96b917e)) * Add weekday (locale aware day of the week) plugin ([#569](iamkun/dayjs#569)) ([9007cc5](iamkun/dayjs@9007cc5)), closes [#559](iamkun/dayjs#559) * Allow customizing "am" / "pm" strings with locale meridiem function ([#580](iamkun/dayjs#580)) ([576e93e](iamkun/dayjs@576e93e)), closes [#578](iamkun/dayjs#578) * Fix `.add` day/week decimal rouding bug ([800f6c9](iamkun/dayjs@800f6c9)) * Fix `.diff` type definition error ([#565](iamkun/dayjs#565)) ([c4921ae](iamkun/dayjs@c4921ae)), closes [#561](iamkun/dayjs#561) * Fix CustomParseFormat plugin bug ([#568](iamkun/dayjs#568)) ([1f5a9db](iamkun/dayjs@1f5a9db)), closes [#555](iamkun/dayjs#555) * Fix relativeTime plugin Math.round bug ([40bea40](iamkun/dayjs@40bea40)) * skip square brackets in buddhistEra, advancedFormat plugins ([#556](iamkun/dayjs#556)) ([9279718](iamkun/dayjs@9279718)), closes [#554](iamkun/dayjs#554) * Update Indonesian locale([#574](iamkun/dayjs#574)) ([0aa7143](iamkun/dayjs@0aa7143)) * Update locale month to support both array and function ([#581](iamkun/dayjs#581)) ([b6599d3](iamkun/dayjs@b6599d3)) * Update LocalizedFormat plugin lowercase formats logic ([#557](iamkun/dayjs#557)) ([d409304](iamkun/dayjs@d409304))
Inspired from #541
This PR imports
relativeTime
andformats
from momentjs locales.I have skipped the ones that uses function like https://github.com/moment/moment/blob/d0f0dd8f40be987593767a3dc5e27c45c6a3fa49/locale/he.js#L45-L50 to keep it simple
I have also made locale tests independent, so that it tests all locales even when one of them fails, let me know if I need to revert that.
Locales with missing keys