Web Components from early 2024
Briefly

This constructor allows developers to consume a JavaScript DateTime and spit back out a string formatted to represent that date and time as relative to the present. What's more, it even has the ability to consider the locale (language) of the document it's in, the language of the user's browser, etc.
I combined these things to make a Web Component that can wrap around a <time> element to present certain DateTimes around my website to give a better context around when certain things will take place (in the future) or took place (in the past).
Without JavaScript, the user will see a simple message, but with JavaScript enabled, the Web Component dynamically updates to show the relative time (e.g., '2nd of May, 2024').
Read at Chris Burnell
[
add
]
[
|
|
]