Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Format Dates With Internationalization API: RelativeTimeFormat EN+NL

node v16.18.0
version: 3.0.0
endpointsharetweet
const differenceInHours = require('date-fns/differenceInHours') const diff = differenceInHours( new Date(2021, 6, 2, 6, 50), new Date(), ) const rtf = new Intl.RelativeTimeFormat("en"); console.log(rtf.format(diff, 'hour'))
const diff2 = differenceInHours( new Date(2021, 6, 2, 6, 50), new Date(), ) const rtf2 = new Intl.RelativeTimeFormat("nl"); console.log(rtf2.format(diff2, 'hour'))
Loading…

no comments

    sign in to comment