Skip to content

barelyhuman/timestamps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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

About

A tiny timestamp parsing and formatting library (Node, Deno, ESM)

Topics

Resources

License

Stars

Watchers

Forks