@barelyhuman/timestamps

0.0.3 • Public • Published

@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

Readme

Keywords

none

Package Sidebar

Install

npm i @barelyhuman/timestamps

Weekly Downloads

4

Version

0.0.3

License

MIT

Unpacked Size

10.1 kB

Total Files

5

Last publish

Collaborators

  • barelyreaper