npm.io
1.0.0 • Published 3 years ago

@sensethenlove/get-relative-time

Licence
MIT
Version
1.0.0
Deps
0
Size
42 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

@sensethenlove/get-relative-time

Description

Simple function that recieves a date and gives back the relative time using Intl.RelativeTimeFormat('en', { numeric: 'auto' })

Install

pnpm add @sensethenlove/get-relative-time
Example
import { getRelativeTime } from '@sensethenlove/get-relative-time'

getRelativeTime(new Date()) // now
getRelativeTime(new Date('2023-05-05')) // tomorrow
getRelativeTime(new Date('1991-04-08')) // 32 years ago
Supports
  • Seconds
  • Minutes
  • Hours
  • Days
  • Weeks
  • Months
  • Years
Our helpful packages!

Keywords