Open Cthulahoop opened 4 years ago
The relativeTimeThresholdOptions
do not actually get set on the moment
object, they are set and used (currently) in the amDuration
pipe, so they will not get set on the moment
object until the amDuration
pipe gets called.
If you add a call in your template to the amDuration
pipe then you will see that moment.relativeTimeThreshold('ss')
will return the correct value
That's weird.
relativeTimeThresholdOptions
should also be applied to amTimeAgo
pipe.
When using moment.from
or moment.fromNow
moment uses the Relative Time Thresholds
See example
Description of the Issue and Steps to Reproduce:
Did you search for duplicate issue? [Yes / ~no~]
Please describe the issue and steps to reproduce, preferably with a code sample / plunker:
Adding the
relativeTimeThresholdOptions
object to the imports as shown in the Usage section of the readme doesn't change the moment relative time thresholds.Demo
Please see StackBlitz demo here
Notes
relativeTimeThresholdOptions
object is set inapp.module.ts
and should set thess
threshold to1
(so that seconds start showing nearly right away).ss
threshold value returns44
, which is the default (s
==45
,ss
==s - 1
).app.component.ts
, uncommenting line 16.The workaround is to set
moment.relativeTimeThreshold
manually, but this is kludgy.Ensure your issue is isolated to ngx-moment. Issues involving third party tools will be closed unless submitted by the tool's author/maintainer.
Environment:
Please answer the following questions:
moment
version? ^2.24.0moment-timezone
? no