Skip to content

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

Description

@rxaviers

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions