@based/pretty-date
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Pretty date

Small package to nicely format a numerical date to a human readable date.

This package transform a numerical date into a human-readable format. There are several formats available.

Install

$ npm i @based/pretty-date

Usage

import { prettyDate } from '@based/pretty-date'

const time = Date.now() - 1e5 // a few minutes ago, as an epoch number

console.log(prettyDate(time,'date-time-human')) // => prints '17 minutes ago'
console.log(prettyDate(time,'date-time-text')) // => prints 'September 13, 2021, 9:37:44 AM'
console.log(prettyDate(time,'date-time')) // => prints '9:37 13/9/2021'
console.log(prettyDate(time,'date')) // => prints '13/9/2021'
console.log(prettyDate(time,'time')) // => prints '9:37'
console.log(prettyDate(time,'time-precise')) // => prints '9:37:44'

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    92
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    92
  • 1.0.3
    15
  • 1.0.2
    1
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i @based/pretty-date

Weekly Downloads

31

Version

1.0.4

License

MIT

Unpacked Size

12 kB

Total Files

8

Last publish

Collaborators

  • nfrade
  • kylemarch513
  • framma
  • olliv
  • youzid
  • rase-
  • saulx