/use-date-format

Format dates with React

Primary LanguageTypeScriptMIT LicenseMIT

🌘 @ricardojrmcom/use-date-format

Format dates with React

build license

author

lang version size




Install

npm install @ricardojrmcom/use-date-format

yarn add @ricardojrmcom/use-date-format

Usage

import { useDateFormat, useDateRelative } from '@ricardojrmcom/use-date-format';

useDateFormat(new Date('2022-01-31'))
-> '12:00 AM - 31 Jan, 2022 GMT'

useDateRelative(new Date('2022-01-31'))
->  {
      from: '2 months ago',
      fromNow: 'in 2 months',
      to: 'in 2 months',
      toNow: '2 months ago',
    }



License

MIT © Ricardo <l1b3r_-> Mota (@ricardojrmcom)

Bootstrapped with 🟣@ricardojrmcom/supernova