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

Precision for what to display #252

Open
Wulfheart opened this issue Feb 22, 2023 · 3 comments
Open

Precision for what to display #252

Wulfheart opened this issue Feb 22, 2023 · 3 comments

Comments

@Wulfheart
Copy link

Wulfheart commented Feb 22, 2023

Hello,

I would like to display some dates relatively to now. However, I want to display it at max days, no weeks, months, years, etc. Is this somehow possible? I only found the precision which works vice versa.
I think it is possible as the docs/cheatsheets in the readme show some things like "in 30 day" but for me this only gives things like "next week" or "next month".

Codepen: https://codepen.io/wulfheart/pen/oNPxVKK

<relative-time datetime="2023-03-31T16:30:00-08:00" lang="en" format="relative" threshold="P90D">
  2023-02-28
</relative-time>

Thank you in advance.

@keithamus
Copy link
Member

Thanks for the issue! I think we could add largestUnit & smallestUnit properties which map to the Duration format. This could replace precision also.

@Wulfheart
Copy link
Author

Oh. This would be really cool. Are you open for a PR on this?

@keithamus
Copy link
Member

We need some architectural changes to support this before we move forward; right now the Duration ponyfill does not support round() which I think would be the first step toward making this a reality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants