{"_id":"@ahxar/go-time","_rev":"7-955c7608fdcf0c59f5c37fcd103334fa","name":"@ahxar/go-time","dist-tags":{"latest":"1.1.6"},"versions":{"1.0.0":{"name":"@ahxar/go-time","version":"1.0.0","keywords":["time","golang","go-time","duration","timezone"],"license":"MIT","_id":"@ahxar/go-time@1.0.0","maintainers":[{"name":"ahxar","email":"ahmadsafar88@gmail.com"}],"dist":{"shasum":"45aa8a95b1ca0460960b31843017078d5066670e","tarball":"https://registry.npmjs.org/@ahxar/go-time/-/go-time-1.0.0.tgz","fileCount":27,"integrity":"sha512-lB9/EvuGv8Y9PziDdqtTtsolquYSlnaAZEI78Fr4Vjse71blPbVpdCxmiydd53j9YDnnoAfchCeM48AalssfXA==","signatures":[{"sig":"MEUCIQCpleEaudaGMCw6cJFloPR3MKUpovEfzoyxCYhXdpwjCgIgMjH1rfkKmHa7Wts+Llu8+tZrUlkqQao5jh7IVtpdlmc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":139757},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"9aac71324d29cc64ef1a2b15f987f7acc2d9b2d0","scripts":{"lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\"","test":"npm run build:test && node --test \"dist-test/test/*.test.js\"","build":"tsc -p tsconfig.build.json","clean":"rm -rf dist dist-test","format":"prettier . --write","lint:fix":"eslint \"src/**/*.ts\" \"test/**/*.ts\" --fix","typecheck":"tsc -p tsconfig.json --noEmit","build:test":"tsc -p tsconfig.test.json","format:check":"prettier . --check"},"_npmUser":{"name":"ahxar","email":"ahmadsafar88@gmail.com"},"_npmVersion":"11.6.2","description":"Go time-inspired API for Node.js with zero runtime dependencies","directories":{},"_nodeVersion":"24.11.1","_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.2.0","globals":"^17.4.0","prettier":"^3.8.1","@eslint/js":"^10.0.1","typescript":"^5.8.3","@types/node":"^22.19.17","typescript-eslint":"^8.58.1","eslint-config-prettier":"^10.1.8"},"_npmOperationalInternal":{"tmp":"tmp/go-time_1.0.0_1775630173920_0.06935023691002584","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@ahxar/go-time","version":"1.1.0","keywords":["time","golang","go-time","duration","timezone"],"license":"MIT","_id":"@ahxar/go-time@1.1.0","maintainers":[{"name":"ahxar","email":"ahmadsafar88@gmail.com"}],"homepage":"https://github.com/ahxar/go-time#readme","bugs":{"url":"https://github.com/ahxar/go-time/issues"},"dist":{"shasum":"eccff65ea731632c73109da00e7a3af4aac6eab7","tarball":"https://registry.npmjs.org/@ahxar/go-time/-/go-time-1.1.0.tgz","fileCount":15,"integrity":"sha512-Q2GCpd5swmJ1F0jDKQYJOsglprkK1+57AHWK66jsFLWWzyXeApkZdzh0zWaX+bqW1ljVivCXcWT1DThLeY2t+w==","signatures":[{"sig":"MEYCIQC0jBxWKxgUs5KlbRge96traM/EBdwEqu8wUPhwyVcXSgIhAKboy1JC5i6ckB7GiLq4iT7h7AyM12O1JG1cmOYA2O0i","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahxar%2fgo-time@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":83352},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"19873b2314c46b39f7c106fe09e9826ba720e4cf","scripts":{"lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\"","test":"npm run build:test && node --test \"dist-test/test/*.test.js\"","build":"rm -rf dist && tsc -p tsconfig.build.json","clean":"rm -rf dist dist-test","format":"prettier . --write","lint:fix":"eslint \"src/**/*.ts\" \"test/**/*.ts\" --fix","typecheck":"tsc -p tsconfig.json --noEmit","build:test":"tsc -p tsconfig.test.json","format:check":"prettier . --check"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:acb268ab-b91f-42ac-951c-99d170a29100"}},"repository":{"url":"git+https://github.com/ahxar/go-time.git","type":"git"},"_npmVersion":"11.11.0","description":"Go time-inspired API for Node.js with zero runtime dependencies","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.2.0","globals":"^17.4.0","prettier":"^3.8.1","@eslint/js":"^10.0.1","typescript":"^5.8.3","@types/node":"^22.19.17","typescript-eslint":"^8.58.1","eslint-config-prettier":"^10.1.8"},"_npmOperationalInternal":{"tmp":"tmp/go-time_1.1.0_1775647768311_0.4384245794343895","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@ahxar/go-time","version":"1.1.2","keywords":["duration","go-time","golang","time","timezone"],"license":"MIT","_id":"@ahxar/go-time@1.1.2","maintainers":[{"name":"ahxar","email":"ahmadsafar88@gmail.com"}],"homepage":"https://github.com/ahxar/go-time#readme","bugs":{"url":"https://github.com/ahxar/go-time/issues"},"dist":{"shasum":"c220378765473ebfc0ea2ca8dff31c39074448a6","tarball":"https://registry.npmjs.org/@ahxar/go-time/-/go-time-1.1.2.tgz","fileCount":9,"integrity":"sha512-NSVMw7M0Tv6Vo5USAGZYgtT85R2Xzv2XBRtfpDEt81w8h+dDi5H79GwMCwHR+lpGMETEDypZY42P/L59P2l9pw==","signatures":[{"sig":"MEYCIQDIfDhurRYFWhsDdohL+OIMcKfqIdlKgQmnvVXHWfh1RAIhAJ5ZQBZxS8+OVbKrQ4ecI5FJvwc8EburOjs5u6q3pE8R","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahxar%2fgo-time@1.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":252359},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"1644b12b3eb8400a52026d52514d377031051434","scripts":{"fmt":"oxfmt .","lint":"oxlint .","test":"vitest run","build":"tsdown","check":"tsc --noEmit","lint:fix":"oxlint --fix .","fmt:check":"oxfmt --check ."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:acb268ab-b91f-42ac-951c-99d170a29100"}},"repository":{"url":"git+https://github.com/ahxar/go-time.git","type":"git"},"_npmVersion":"11.11.0","description":"Go time-inspired API for Node.js with zero runtime dependencies","directories":{},"sideEffects":false,"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"oxfmt":"^0.44.0","oxlint":"^1.59.0","tsdown":"^0.21.7","vitest":"^4.1.3","typescript":"^6.0.2","@types/node":"^25.5.2","@emnapi/runtime":"^1.9.2","@vitest/coverage-v8":"^4.1.3"},"_npmOperationalInternal":{"tmp":"tmp/go-time_1.1.2_1775669982588_0.2474289406180672","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"name":"@ahxar/go-time","version":"1.1.3","keywords":["duration","go-time","golang","time","timezone"],"license":"MIT","_id":"@ahxar/go-time@1.1.3","maintainers":[{"name":"ahxar","email":"ahmadsafar88@gmail.com"}],"homepage":"https://github.com/ahxar/go-time#readme","bugs":{"url":"https://github.com/ahxar/go-time/issues"},"dist":{"shasum":"2d4bb8d1732dd3379dea3fdcd3ca39e22ecb4b6b","tarball":"https://registry.npmjs.org/@ahxar/go-time/-/go-time-1.1.3.tgz","fileCount":9,"integrity":"sha512-/388qOyKVk42yfuz1gK6oRw3c/Xmq30g1K6UgDGcosu4FGH79qIhfKXsux2+noeo3HmZJHX1N4kcBtvIxtvG3A==","signatures":[{"sig":"MEQCID1fZ5sicfEhkzUUpJoRmdmNS4kNV9fM+YI02EyEn7e4AiAuPobrdRmVmj3roZQo0GXcCi/vcq8AAQMaHvLhdZ1f8Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahxar%2fgo-time@1.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":253154},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"53efee8d9be6e5272cb1e8e81d28ff1db9f1aa69","scripts":{"fmt":"oxfmt .","lint":"oxlint .","test":"vitest run","build":"tsdown","check":"tsc --noEmit","lint:fix":"oxlint --fix .","fmt:check":"oxfmt --check .","example:full":"tsx examples/full.ts","example:time":"tsx examples/02-time.ts","example:timer":"tsx examples/04-timer.ts","example:duration":"tsx examples/01-duration.ts","example:location":"tsx examples/03-location.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:acb268ab-b91f-42ac-951c-99d170a29100"}},"repository":{"url":"git+https://github.com/ahxar/go-time.git","type":"git"},"_npmVersion":"11.11.0","description":"Go time-inspired API for Node.js with zero runtime dependencies","directories":{},"sideEffects":false,"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.4","oxfmt":"^0.44.0","oxlint":"^1.59.0","tsdown":"^0.21.7","vitest":"^4.1.3","typescript":"^6.0.2","@types/node":"^25.5.2","@emnapi/runtime":"^1.9.2","@vitest/coverage-v8":"^4.1.3"},"_npmOperationalInternal":{"tmp":"tmp/go-time_1.1.3_1775794904464_0.8505906164312602","host":"s3://npm-registry-packages-npm-production"}},"1.1.4":{"name":"@ahxar/go-time","version":"1.1.4","keywords":["duration","go-time","golang","time","timezone"],"license":"MIT","_id":"@ahxar/go-time@1.1.4","maintainers":[{"name":"ahxar","email":"ahmadsafar88@gmail.com"}],"homepage":"https://github.com/ahxar/go-time#readme","bugs":{"url":"https://github.com/ahxar/go-time/issues"},"dist":{"shasum":"0b6bf48739af5ecaa59b7fb837fbb995dd1578f3","tarball":"https://registry.npmjs.org/@ahxar/go-time/-/go-time-1.1.4.tgz","fileCount":9,"integrity":"sha512-xhiIxirTE/gxeJrxJOxuAIu6ZEV3MckN0KxpKmw+gkzVbfkCO9xIsS4+ONJmAJj72KpgP2qc6XocswSeZ8CXmA==","signatures":[{"sig":"MEQCIHrWIPZRyerHHKXgZbriUFk0BuZjz16y90eue/7ohnmGAiAZKASMn07LqjGK8BpmX/EwVXAf+g3gaNR5OlsKgRk4IQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahxar%2fgo-time@1.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":257002},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"a6f935b4e8220e461cdfca2c558597d17d7a38cf","scripts":{"fmt":"oxfmt .","lint":"oxlint .","test":"vitest run","build":"tsdown","check":"tsc --noEmit","lint:fix":"oxlint --fix .","fmt:check":"oxfmt --check .","example:full":"tsx examples/full.ts","example:time":"tsx examples/02-time.ts","example:timer":"tsx examples/04-timer.ts","example:duration":"tsx examples/01-duration.ts","example:location":"tsx examples/03-location.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:acb268ab-b91f-42ac-951c-99d170a29100"}},"repository":{"url":"git+https://github.com/ahxar/go-time.git","type":"git"},"_npmVersion":"11.11.0","description":"Go time-inspired API for Node.js with zero runtime dependencies","directories":{},"sideEffects":false,"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.4","oxfmt":"^0.44.0","oxlint":"^1.59.0","tsdown":"^0.21.7","vitest":"^4.1.3","typescript":"^6.0.2","@types/node":"^25.5.2","@emnapi/runtime":"^1.9.2","@vitest/coverage-v8":"^4.1.3"},"_npmOperationalInternal":{"tmp":"tmp/go-time_1.1.4_1775800050149_0.7920619211786026","host":"s3://npm-registry-packages-npm-production"}},"1.1.5":{"name":"@ahxar/go-time","version":"1.1.5","keywords":["duration","go-time","golang","time","timezone"],"license":"MIT","_id":"@ahxar/go-time@1.1.5","maintainers":[{"name":"ahxar","email":"ahmadsafar88@gmail.com"}],"homepage":"https://github.com/ahxar/go-time#readme","bugs":{"url":"https://github.com/ahxar/go-time/issues"},"dist":{"shasum":"301533ce910341930739dd39ec167e8bd005f5fc","tarball":"https://registry.npmjs.org/@ahxar/go-time/-/go-time-1.1.5.tgz","fileCount":9,"integrity":"sha512-Si57FMLxrdeEwJ/7V44v8y0KnoEWoCTHS8eaBgJ/MQSmukfxUPn4q7A+AGqVxJk8+/S5ckm1wxyD4d5mMdNycA==","signatures":[{"sig":"MEYCIQCYv+ic2HZizLplYFHIMlTfIo5zxNSwmqBTZqQw1mYWbAIhAKl3uIeiOlSEipD8+BVugaz2QFW3pDT9YFLGXLncbhQ5","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahxar%2fgo-time@1.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":257187},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"7361c355fb689d78e43064de275585529b46090d","scripts":{"fmt":"oxfmt .","lint":"oxlint .","test":"vitest run","build":"tsdown","check":"tsc --noEmit","lint:fix":"oxlint --fix .","fmt:check":"oxfmt --check .","example:full":"tsx examples/full.ts","example:time":"tsx examples/02-time.ts","example:timer":"tsx examples/04-timer.ts","example:duration":"tsx examples/01-duration.ts","example:location":"tsx examples/03-location.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:acb268ab-b91f-42ac-951c-99d170a29100"}},"repository":{"url":"git+https://github.com/ahxar/go-time.git","type":"git"},"_npmVersion":"11.11.0","description":"Go time-inspired API for Node.js with zero runtime dependencies","directories":{},"sideEffects":false,"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.4","oxfmt":"^0.44.0","oxlint":"^1.59.0","tsdown":"^0.21.7","vitest":"^4.1.3","typescript":"^6.0.2","@types/node":"^25.5.2","@emnapi/runtime":"^1.9.2","@vitest/coverage-v8":"^4.1.3"},"_npmOperationalInternal":{"tmp":"tmp/go-time_1.1.5_1775839204723_0.868197745341732","host":"s3://npm-registry-packages-npm-production"}},"1.1.6":{"name":"@ahxar/go-time","version":"1.1.6","description":"Go time-inspired API for Node.js with zero runtime dependencies","keywords":["duration","go-time","golang","time","timezone"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ahxar/go-time.git"},"type":"module","sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"scripts":{"build":"tsdown","check":"tsc --noEmit","fmt":"oxfmt .","fmt:check":"oxfmt --check .","lint":"oxlint .","lint:fix":"oxlint --fix .","test":"vitest run","example:duration":"tsx examples/01-duration.ts","example:time":"tsx examples/02-time.ts","example:location":"tsx examples/03-location.ts","example:timer":"tsx examples/04-timer.ts","example:full":"tsx examples/full.ts"},"devDependencies":{"@emnapi/runtime":"^1.9.2","@types/node":"^25.5.2","@vitest/coverage-v8":"^4.1.3","oxfmt":"^0.44.0","oxlint":"^1.59.0","tsdown":"^0.21.7","tsx":"^4.19.4","typescript":"^6.0.2","vitest":"^4.1.3"},"engines":{"node":">=20"},"gitHead":"c2a1e136acd14875776bcd6c48fd573600fbecca","_id":"@ahxar/go-time@1.1.6","bugs":{"url":"https://github.com/ahxar/go-time/issues"},"homepage":"https://github.com/ahxar/go-time#readme","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-7St3DRTXQBP7J60WUWSqewNWnlx3pHtD8o5sFkxx+WC4mkFyVIMvtYS/PSpCxpEPAdHAD24OtRYx4Vx9PJykTQ==","shasum":"8150ae7755b5da2e211143e3f2624d4192a86d7a","tarball":"https://registry.npmjs.org/@ahxar/go-time/-/go-time-1.1.6.tgz","fileCount":9,"unpackedSize":309580,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ahxar%2fgo-time@1.1.6","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD+CCShKZJE0fGg9qZUXMMnavbqTnMVG7ZGqyA3Q7TgXAIhAIFFxj4/Q5zSQzIyw451qSDisIrcFJ2jdUs3YkyxhFda"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:acb268ab-b91f-42ac-951c-99d170a29100"}},"directories":{},"maintainers":[{"name":"ahxar","email":"ahmadsafar88@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/go-time_1.1.6_1775841098865_0.2450265668621674"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-08T06:36:13.803Z","modified":"2026-04-10T17:11:39.301Z","1.0.0":"2026-04-08T06:36:14.095Z","1.1.0":"2026-04-08T11:29:28.473Z","1.1.2":"2026-04-08T17:39:42.743Z","1.1.3":"2026-04-10T04:21:44.609Z","1.1.4":"2026-04-10T05:47:30.287Z","1.1.5":"2026-04-10T16:40:04.895Z","1.1.6":"2026-04-10T17:11:39.015Z"},"bugs":{"url":"https://github.com/ahxar/go-time/issues"},"license":"MIT","homepage":"https://github.com/ahxar/go-time#readme","keywords":["duration","go-time","golang","time","timezone"],"repository":{"type":"git","url":"git+https://github.com/ahxar/go-time.git"},"description":"Go time-inspired API for Node.js with zero runtime dependencies","maintainers":[{"name":"ahxar","email":"ahmadsafar88@gmail.com"}],"readme":"# go-time\n\n[![CI and Release](https://github.com/ahxar/go-time/actions/workflows/ci-release.yml/badge.svg)](https://github.com/ahxar/go-time/actions/workflows/ci-release.yml)\n[![npm version](https://img.shields.io/npm/v/%40ahxar%2Fgo-time)](https://www.npmjs.com/package/@ahxar/go-time)\n[![npm downloads](https://img.shields.io/npm/dm/%40ahxar%2Fgo-time)](https://www.npmjs.com/package/@ahxar/go-time)\n[![License](https://img.shields.io/github/license/ahxar/go-time)](LICENSE)\n\nGo-inspired time utilities for Node.js with TypeScript types and zero runtime dependencies.\n\n`go-time` brings familiar Go `time` concepts to JavaScript and TypeScript: durations, layouts, parsing/formatting, locations, timers, and tickers.\n\nPrecision note: `go-time` is built on JavaScript `Date`, so wall-clock time values are limited to millisecond precision.\n\n## Features\n\n- Go-style duration values and parser (`2h45m10.5s`)\n- `Time` API for millisecond-precision arithmetic, comparisons, rounding, truncation, and calendar fields\n- Monotonic clock support for stable elapsed-time measurement with `now()`, `sub()`, `since()`, and `until()`\n- Layout-based parse/format helpers (`RFC3339`, `DateTime`, `Kitchen`, and more)\n- Time zone support with UTC, local, fixed offsets, and IANA zone names\n- Timer and ticker primitives inspired by Go channels\n- ESM-first package with generated TypeScript declarations\n- No runtime dependencies\n\n## Installation\n\n```bash\nnpm install @ahxar/go-time\n```\n\n## Requirements\n\n- Node.js 20+\n\n## Quick Start\n\n```ts\nimport {\n  DateTime,\n  Millisecond,\n  Month,\n  RFC3339,\n  date,\n  now,\n  parse,\n  since,\n  sleep,\n  unixMilli,\n} from \"@ahxar/go-time\";\n\nconst started = now();\n\nconst timeout = 250n * Millisecond;\nawait sleep(timeout);\n\nconst elapsed = since(started);\nconsole.log(elapsed.toString()); // e.g. \"252.3ms\"\n\nconst t1 = parse(RFC3339, \"2026-04-08T09:10:11.123Z\");\nconsole.log(t1.millisecond()); // 123\n\nconst t2 = date(2026, Month.April, 8, 12, 30, 0, 0);\nconsole.log(t2.format(DateTime)); // \"2026-04-08 12:30:00\"\n\nconst t3 = unixMilli(1_700_000_000_123n);\nconsole.log(t3.unixMilli()); // 1700000000123n\n```\n\n## Core Concepts\n\n### Duration\n\n```ts\nimport { Hour, Minute, Second, parseDuration } from \"@ahxar/go-time\";\n\nconst a = parseDuration(\"2h45m10.5s\");\nconst b = parseDuration(\"90s\");\nconst c = parseDuration(\"1h30m\");\n\nconsole.log(a.milliseconds()); // 9910500n\nconsole.log(b.round(Second).toString()); // \"1m30s\"\nconsole.log(c.truncate(Minute).toString()); // \"1h30m0s\"\n```\n\nSupported units: `ms`, `s`, `m`, `h`.\n\n### Time and Layouts\n\n`Time` uses JavaScript `Date` under the hood, so parsing, formatting, constructors, and current-time reads only support millisecond precision.\n\n```ts\nimport {\n  DateOnly,\n  DateTime,\n  Kitchen,\n  RFC3339,\n  parse,\n  parseInLocation,\n  fixedZone,\n} from \"@ahxar/go-time\";\n\nconst t = parse(RFC3339, \"2026-04-08T09:10:11.123Z\");\n\nconsole.log(t.format(DateOnly)); // \"2026-04-08\"\nconsole.log(t.format(DateTime)); // \"2026-04-08 09:10:11\"\nconsole.log(t.format(Kitchen)); // \"9:10AM\"\nconsole.log(t.format(RFC3339)); // \"2026-04-08T09:10:11.123Z\"\n\nconst plus2 = fixedZone(\"PLUS2\", 2 * 3600);\nconst localClock = parseInLocation(DateTime, \"2026-04-08 12:00:00\", plus2);\nconsole.log(localClock.zone()); // { name: \"PLUS2\", offsetSeconds: 7200 }\n```\n\n`before()`, `after()`, and `equal()` compare the underlying UTC instant, so the location attached to a `Time` value does not affect the result.\n\n```ts\nimport { RFC3339, fixedZone, parse } from \"@ahxar/go-time\";\n\nconst utc = parse(RFC3339, \"2026-04-08T12:00:00Z\");\nconst plus2 = fixedZone(\"PLUS2\", 2 * 3600);\nconst same = utc.in(plus2); // same instant, displayed as 14:00 PLUS2\n\nconsole.log(utc.equal(same)); // true  — same UTC instant\nconsole.log(utc.before(same)); // false\nconsole.log(utc.after(same)); // false\n```\n\nRounding and truncation to the minute:\n\n```ts\nimport { DateTime, Minute, Month, UTC, date } from \"@ahxar/go-time\";\n\nconst at30s = date(2026, Month.April, 8, 12, 34, 30, 0, UTC);\n\nconsole.log(at30s.format(DateTime)); // \"2026-04-08 12:34:30\"\nconsole.log(at30s.truncate(Minute).format(DateTime)); // \"2026-04-08 12:34:00\"\nconsole.log(at30s.round(Minute).format(DateTime)); // \"2026-04-08 12:35:00\"\n```\n\n### Monotonic Time\n\n`now()` records both wall-clock time and a monotonic reading. When two `Time` values both carry monotonic data, `sub()`, `since()`, and `until()` use the monotonic clock for elapsed-time calculations instead of wall-clock time.\n\nThis makes elapsed-time measurement stable across wall-clock adjustments. Times created with `unix()`, `unixMilli()`, `date()`, or `parse()` do not include monotonic data.\n\n```ts\nimport { Millisecond, Second, now, since, sleep, unix } from \"@ahxar/go-time\";\n\nconst started = now();\nawait sleep(25n * Millisecond);\n\nconst elapsed = since(started);\nconsole.log(elapsed.milliseconds()); // about 25\n\nconst a = now();\nconst b = a.add(Second);\nconsole.log(b.sub(a).seconds()); // 1\n\nconst wallOnly = unix(1_700_000_000n);\nconsole.log(typeof wallOnly.unix()); // \"bigint\"\n// `wallOnly` has no monotonic reading, so subtraction falls back to wall-clock time.\n```\n\n### Locations\n\n```ts\nimport { Local, UTC, fixedZone, loadLocation, now } from \"@ahxar/go-time\";\n\nconst t = now();\n\nconst utc = t.in(UTC);\nconst local = t.in(Local);\nconst est = t.in(fixedZone(\"EST\", -5 * 3600));\nconst berlin = t.in(loadLocation(\"Europe/Berlin\"));\n\nconsole.log(utc.zone()); // { name: \"UTC\", offsetSeconds: 0 }\nconsole.log(local.zone()); // e.g. { name: \"Local\", offsetSeconds: -25200 }\nconsole.log(est.zone()); // { name: \"EST\", offsetSeconds: -18000 }\nconsole.log(berlin.zone()); // e.g. { name: \"Europe/Berlin\", offsetSeconds: 7200 }\n```\n\n### Timers and Tickers\n\n```ts\nimport { Millisecond, newTicker, newTimer } from \"@ahxar/go-time\";\n\nconst timer = newTimer(50n * Millisecond);\nconst firedAt = await timer.C.recv();\nconsole.log(firedAt.unixMilli()); // e.g. 1775649011123n\n\nconst ticker = newTicker(100n * Millisecond);\nlet count = 0;\nfor await (const tick of ticker.C) {\n  console.log(tick.unixMilli()); // e.g. 1775649011223n\n  count += 1;\n  if (count === 3) {\n    ticker.stop();\n    break;\n  }\n}\n```\n\n## Development\n\nInstall dependencies:\n\n```bash\nnpm install\n```\n\nAvailable scripts:\n\n- `npm run build` - compile the publishable package to `dist/`\n- `npm run check` - TypeScript type checks without emitting files\n- `npm run fmt` - format supported files with Oxc\n- `npm run fmt:check` - verify formatting without writing changes\n- `npm run lint` - run Oxlint across the repository\n- `npm run lint:fix` - run Oxlint with auto-fixes\n- `npm test` - run the Vitest suite directly from the TypeScript test files\n\n## Contributing\n\nContributions are welcome.\n\n1. Fork the repository.\n2. Create a feature branch.\n3. Add or update tests in `test/`.\n4. Run `npm run lint`, `npm run check`, and `npm test`.\n5. Open a pull request describing your changes.\n\n## License\n\nMIT. See `LICENSE`.\n","readmeFilename":"README.md"}