https://github.com/barelyhuman/timestamps
A tiny timestamp parsing and formatting library (Node, Deno, ESM)
https://github.com/barelyhuman/timestamps
deno esm library node parse timestamps
Last synced: 2 months ago
JSON representation
A tiny timestamp parsing and formatting library (Node, Deno, ESM)
- Host: GitHub
- URL: https://github.com/barelyhuman/timestamps
- Owner: barelyhuman
- License: mit
- Created: 2023-04-30T22:20:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-01T08:57:14.000Z (over 2 years ago)
- Last Synced: 2025-03-27T17:47:35.303Z (7 months ago)
- Topics: deno, esm, library, node, parse, timestamps
- Language: JavaScript
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# @barelyhuman/timestamps
> A tiny timestamp parsing and formatting library
This is just an internal utility used by TillWhen for parsing and formatting
timestamps.## Installation
```sh
npm i @barelyhuman/timestamps
# or
yarn add @barelyhuman/timestamps
```## Usage
```js
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](/LICENSE)