mirror of
https://github.com/planetrenox/ortus.git
synced 2026-10-29 04:34:53 +00:00
Zero-dependency ESM package with types. now, fromDate, toDate, fromUnixMs, toUnixMs; units ms|s|m|h|d|w, floored toward -Infinity, exact across the full JS Date range. 0BSD. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
720 B
TypeScript
18 lines
720 B
TypeScript
/** PRT units: milliseconds (official), seconds, minutes, hours, days, weeks */
|
|
export type Unit = 'ms' | 's' | 'm' | 'h' | 'd' | 'w'
|
|
|
|
export declare const PRT: Readonly<{
|
|
/** Current PRT, rounded down. Defaults to ms. */
|
|
now(unit?: Unit): number
|
|
/** PRT at the given Date, rounded down. Defaults to ms. */
|
|
fromDate(date: Date, unit?: Unit): number
|
|
/** Date at the given integer PRT value. Defaults to ms. */
|
|
toDate(value: number, unit?: Unit): Date
|
|
/** PRT at the given integer Unix ms, rounded down. Defaults to ms. */
|
|
fromUnixMs(unixMs: number, unit?: Unit): number
|
|
/** Unix ms at the given integer PRT value. Defaults to ms. */
|
|
toUnixMs(value: number, unit?: Unit): number
|
|
}>
|
|
|
|
export default PRT
|