-
-
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
Update fromNow plugin #189
Conversation
Codecov Report
@@ Coverage Diff @@
## master #189 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 15 15
Lines 297 308 +11
Branches 50 52 +2
=====================================
+ Hits 297 308 +11
Continue to review full report at Codecov.
|
Hi! Thank you very much for your work! It indeed is better that way. When I designed the plugin I had timeago.js in mind and a very basic approach to it, not as complex as moment.js |
Thanks @aalises. Any review here? |
@aalises
I update the code of
fromNow
plugin a little bit. Here is the reason:In previous code, we use
resabs !== P[i].v
to check if it is singulara month
or2 months
.However, there is some disadvantage of this kind of check, it must be exactly the same time in millisecond, otherwise, it will result
1 month
instead ofa month
So my solution is, still implement it in Moment.js's way.
We set the output to a range of time. Check the table blew:
Also, added
from
to
toNow
APIs.Should we come up a new name for this plugin, since it's not only
fromNow
now