Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

units to consider when selecting the unit #7

Closed
@zbraniecki

Description

@zbraniecki

Currently, the spec is considering "all" units possible when trying to determine the correct one - seconds, minutes, hours, days, weeks, months, quarters, years.

We still have more units to consider like "last Tuesday", and I can see users wanting to skip "quarters" or calculate only up to days, so - seconds, minutes, hours, normally, but nothing above days (so "4500 days ago").

It seems like a simple solution would be to allow people to pass the list of units to consider:

let x = new Intl.RelativeTimeFormat(locales, {
  unit: 'best fit',
  units: ['second', 'minute', 'hour', 'day']
});

Then, if you want to add weekdays or quarters, you'd just list it as one of the units.

Does it sound realistic?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions