-
Notifications
You must be signed in to change notification settings - Fork 7k
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] Enable relative time for multiple seconds, request #2558 #3738
Conversation
@@ -60,6 +63,11 @@ export function getSetRelativeTimeThreshold (threshold, limit) { | |||
if (limit === undefined) { | |||
return thresholds[threshold]; | |||
} | |||
if (threshold === 's' && !secondsThresholdChanged) { |
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.
This is a bit tricky. I'd drop the variable, always set ss
to limit - 1
, so if you need to use it you need to set ss
last (alone or after s
, which makes sense).
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.
Thanks for the feedback, doing the cleanup and the merge! :)
@pndewit its valid, just clean it a bit as requested and it'll be merged. |
Also make a corresponding PR to the docs repo: https://github.com/moment/momentjs.com |
Merged in ed1fc74 |
[feature] Enable relative time for multiple seconds, request #2558
Docs PR created: moment/momentjs.com#404 |
This PR adds an optional threshold (
ss
) fora few seconds
to%d seconds
. It is built so that it will never display%d seconds
UNLESS the user manually sets thess
threshold. Setting thess
threshold once will separate the default value (which is the value in thes
threshold minus 1).As mentioned in #2558, there is no translation for:
%d seconds
. I could add this for each locale using theseconds
word that is already present in each locale for thes
threshold (e.g.a few **seconds**
), but I don't know if this would work for all locales. So then this would require a review from a native speaker for each locale. Probably not gonna happen.#2182: I hope by not actively using this
ss
threshold by default (afaik this is backwards compatible), this PR still has a chance.Let me know what you think :)