0.0.3 • Published 1 year ago

@barelyhuman/timestamps v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@barelyhuman/timestamps

A tiny timestamp parsing and formatting library

This is just an internal utility used by TillWhen for parsing and formatting timestamps.

Installation

npm i @barelyhuman/timestamps
# or
yarn add @barelyhuman/timestamps

Usage

import {
  fromSeconds,
  fromMilliseconds,
  formatSeconds,
  formatMilliseconds,
  parse,
} from '@barelyhuman/timestamps'

fromSeconds(3600) // {hours:1, minutes:0, seconds:0}
fromMilliseconds(3600 * 1000) // {hours:1, minutes:0, seconds:0}
formatSeconds(3600, '{hh}:{mm}:{ss}') // 01:00:00
formatMilliseconds(3600 * 1000, '{hh}:{mm}:{ss}') // 01:00:00
parse('01:00:00', '{hh}:{mm}:{ss}') // {hours:1, minutes:0, seconds:0}

License

LICENSE

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago