-
-
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
Feature: Relative time for fusional languages #659
Feature: Relative time for fusional languages #659
Conversation
… or past prop as a fn for relative time
Codecov Report
@@ Coverage Diff @@
## dev #659 +/- ##
==========================================
- Coverage 99.89% 99.43% -0.47%
==========================================
Files 154 154
Lines 989 1055 +66
Branches 148 176 +28
==========================================
+ Hits 988 1049 +61
- Misses 1 5 +4
- Partials 0 1 +1
Continue to review full report at Codecov.
|
Thanks, but here's a simple one. #767 |
Polish seems to be not handled in #767. |
@iamkun how to know when / whether this fix is available in release (and which version)? |
next coming version |
Hi,
Currently there are several issues regarding relative time on fusional languages, this PR would address these issues (I hope I didn't miss any):
#610 #416 #415 #302
I have looked through moment implementation of relative time and adapted it to fit dayjs. I am aware that a lot of the this code is taken from moment, but I don't think that reinventing the wheel in this place is a good approach. I think it is okay to have moment as a point of truth for proper localization results, because translation is a very long process and this makes it easy to have correct translations even without knowing the language.
There are a couple of fixes in language translations (polish for example was completely off, since translating relative time to the past translates it as a future term, see "po 1 godziny" for example.).
I have also added preparsers/postparsers when needed. In this case Arabic locale numerals.
I've added tests and some helpers to reduce code duplication and add coverage to localized formats. Current implementation makes it easy to compare dayjs localization results with moment. There are some cases that are difficult to cover, so I'm leaving it not as 100% for now.
I've also added handling for relative time formats as functions, which addresses plural forms in most cases.
Thanks in advance for taking a moment (no pun intended) to look into this and please voice any concerns that you may have.