github / relative-time-element

Web component extensions to the standard <time> element.

Home Page:https://github.github.io/relative-time-element/examples/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

time-until wrong calculation

rnons opened this issue · comments

Today is Jan 18, 2020,

but <time-until datetime="2020-12-31T00:00:00"></time-until> outputs next year

image

  1. The timestamp you used does not have a timezone specified, so the time diff would be your local time ~ 2020/12/31T00:00:00 UTC, which can be further away.
  2. The relative time calculation is rounded here so a 11.5 month rounds up to 12 months away, which is displayed as next year here.
  3. If you wishes to see a more specific <time-until> (aka one that is not loosely rounded), use format="micro", which will give you the exact days until the date.