PRT (Planet Renox Time): ms since 1998-03-14T03:00:00Z

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>
This commit is contained in:
2026-10-19 19:46:17 +00:00
co-authored by Claude Opus 5.5
commit 04d5203e05
7 changed files with 260 additions and 0 deletions
Vendored
+17
View File
@@ -0,0 +1,17 @@
/** 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