-
-
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
Issue317: Introducing Multiple Locale Support #318
Conversation
This commit introduces the following new formats: * LT * LTS * L * LL * LLL * LLLL These tokens define shortcuts to usual, local specific, formats. Example: dayjs().format('LL'); // August 29, 2018
….test.js This commit adds the "long date format" object in src/locale/es.js to allow to use the new LT, LTS, L, LL, LLL, LLLL formats. These new formats are tested in test/display.test.js
Codecov Report
@@ Coverage Diff @@
## master #318 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 32 32
Lines 386 395 +9
Branches 53 54 +1
=====================================
+ Hits 386 395 +9
Continue to review full report at Codecov.
|
Thanks. I'm not sure if we should add this logic into our main bundle or not. Wait for discussion. |
As a |
I added this functionality as a plugin in #305. Differences to this PR:
Plugins bring modularity to Date.js. Varous features can be loaded only by applications, which need it. For example, if an application has a date format in the user configuration, it will not need choosing the format by the user's locale from format aliases in Day.js. |
Thanks @prantlf and @GarreauArthur. I tend to agree with prantlf's PR of adding this functionality as a plugin. |
I am down for @prantlf's plugin. 😄 |
Thank you all! :-) I'm looking forward to getting it merged :-) I would like to replace Moment.js with Day.js, but formatting according to the the user's locale (PR #305) and incorrect localisability of relative times (PR #304) do not allow it yet. The application, which I am working on, runs in two modes:
|
#305 plugin |
Partially closes #317
This branch introduces the following new formats (already in use in moment.js):
These tokens define shortcuts to usual, local specific, formats. Example:
It works for english, french and spanish. To add a new language, we just need to add the following object into the corresponding locale file. Example (src/locale/fr.js):