Skip to content
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

Support instance options.threshold to override static RelativeTime.threshold #10

Open
rxaviers opened this issue Jan 23, 2020 · 0 comments

Comments

@rxaviers
Copy link
Owner

Currently, it's possible to change the threshold configuration at library-wide level [1]. It should also be possible to change that at an instance level by allowing an options.threshold [2].

1:

const relativeTime = new RelativeTime();
relativeTime.format(aTwoYearsAgoDate));
// > '2 years ago'

RelativeTime.threshold.month = Infinity;
relativeTime.format(aTwoYearsAgoDate);
// > '24 months ago'

2:

const relativeTime1 = new RelativeTime();
relativeTime1.format(aTwoYearsAgoDate));
// > '2 years ago'

const relativeTime2 = new RelativeTime({threshold: {month: Infinity}});
relativeTime2.format(aTwoYearsAgoDate);
// > '24 months ago'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant