Answers for "date-fns format"

4

date-fns npm package

npm install date-fns --save
# or with yarn 
yarn add date-fns
Posted by: Guest on September-09-2020
0

date-fns format

import { format, formatDistance, formatRelative, subDays } from 'date-fns'

format(new Date(), "'Today is a' eeee")
//=> "Today is a Saturday"

formatDistance(subDays(new Date(), 3), new Date(), { addSuffix: true })
//=> "3 days ago"

formatRelative(subDays(new Date(), 3), new Date())
//=> "last Friday at 7:26 p.m."
Posted by: Guest on April-10-2021

Code answers related to "date-fns format"

Browse Popular Code Answers by Language