Back to Browse

Formatting dates and times in JavaScript just got WAY easier!

10.1K views
Jul 22, 2019
13:40

Let's talk date and time formatting, shall we? Good. I'm going to make a custom element that neatly wraps a date/time value and makes it relative to the current time! The specifics of the code can be found here! https://github.com/paullewis/pocket-money/blob/master/src/components/time-display.ts More info on Intl.RelativeTimeFormat at MDN (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat) and the v8 blog (https://v8.dev/features/intl-relativetimeformat)

Download

0 formats

No download links available.

Formatting dates and times in JavaScript just got WAY easier! | NatokHD