{"_id":"@adaskothebeast/http-params-processor-value-to-ms-timestamp","_rev":"4-c7ec615725d362e37d12aa18b64dc688","name":"@adaskothebeast/http-params-processor-value-to-ms-timestamp","dist-tags":{"latest":"12.0.0"},"versions":{"10.0.0":{"name":"@adaskothebeast/http-params-processor-value-to-ms-timestamp","version":"10.0.0","_id":"@adaskothebeast/http-params-processor-value-to-ms-timestamp@10.0.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"dist":{"shasum":"c6a029ebae512546210d3a1c1167c8c0229fe305","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-to-ms-timestamp/-/http-params-processor-value-to-ms-timestamp-10.0.0.tgz","fileCount":15,"integrity":"sha512-pPobwjJhkMX2ZekUQNIu8V+mvdRmYZZAd6pj82kYcYB0hp0Dpa/vn3TibkEHtuXSLisaVgEBUhqLEsF+J+UQVg==","signatures":[{"sig":"MEQCIBmZDfyPC5Fa5UwCUiS+B8Bp6W8vHLxrDXb6Semb754mAiBsncWf7e3/LajPuRAI/ThyzZEFX+U7oEy2jGX+e/eySw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27635},"main":"./src/index.js","type":"commonjs","types":"./src/index.d.ts","gitHead":"1e61d6323f67038b9af916e4f3d263a73fe76497","_npmUser":{"name":"adasko","email":"adaskothebeast@gmail.com"},"_npmVersion":"11.6.2","description":"> Transform complex TypeScript objects into query parameters for Angular, Axios, Fetch, and more","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"peerDependencies":{"@adaskothebeast/http-params-processor-core":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-value-to-ms-timestamp_10.0.0_1768077306634_0.8276343171587477","host":"s3://npm-registry-packages-npm-production"}},"11.0.0":{"name":"@adaskothebeast/http-params-processor-value-to-ms-timestamp","version":"11.0.0","author":{"url":"https://github.com/adaskothebeast","name":"Adam Pluciński","email":"adaskothebeast@gmail.com"},"license":"MIT","_id":"@adaskothebeast/http-params-processor-value-to-ms-timestamp@11.0.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"dist":{"shasum":"e4fa71fab825813e5ecbf57d137755b55c2fc800","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-to-ms-timestamp/-/http-params-processor-value-to-ms-timestamp-11.0.0.tgz","fileCount":8,"integrity":"sha512-14jJoJ8J3eiJhV4SRlA6a/kclOfwb/qprG+P7t+X58F/DA4Iq31jV3rogPLj5rvaMCjTWYZf2gno7zXu5TRQlg==","signatures":[{"sig":"MEQCIGlKep95l0bZ9svJb/gKAnTp/R5HLgpFcYxwOZea4dvVAiAJr+x4qIXHzSs9in9t5a9W0IxvHk0mE1Yu+UlcK+IdHw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@adaskothebeast%2fhttp-params-processor-value-to-ms-timestamp@11.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":38830},"main":"./index.cjs","type":"module","types":"./index.d.ts","module":"./index.js","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.cjs"},"./package.json":"./package.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5a56b94c-2a06-4d4d-882a-b032f75ff0ed"}},"repository":{"url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git","type":"git"},"_npmVersion":"11.6.2","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-value-to-ms-timestamp_11.0.0_1768758179799_0.899829087323242","host":"s3://npm-registry-packages-npm-production"}},"11.1.0":{"name":"@adaskothebeast/http-params-processor-value-to-ms-timestamp","version":"11.1.0","author":{"url":"https://github.com/adaskothebeast","name":"Adam Pluciński","email":"adaskothebeast@gmail.com"},"license":"MIT","_id":"@adaskothebeast/http-params-processor-value-to-ms-timestamp@11.1.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"dist":{"shasum":"3f3be6526dcec9d23b336b834620808f16117cab","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-to-ms-timestamp/-/http-params-processor-value-to-ms-timestamp-11.1.0.tgz","fileCount":8,"integrity":"sha512-SUwqcsC01oX0vy8suo443Cm3wvD6xaNHcvZN0XuSZfTNIG5dtVkhJJvL/gxCnUqshVWLXdlwhPahxHtBZmnYvA==","signatures":[{"sig":"MEUCICUWvbX6CuobRjNLe2bQ4D6gW5edqV5pTRpdyN3VeGkDAiEA3olOoT2XzwmQONI8GL7yW1CbhDlIk/5Hm7RZY5DXT48=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@adaskothebeast%2fhttp-params-processor-value-to-ms-timestamp@11.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":38830},"main":"./index.cjs","type":"module","types":"./index.d.ts","module":"./index.js","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.cjs"},"./package.json":"./package.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5a56b94c-2a06-4d4d-882a-b032f75ff0ed"}},"repository":{"url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git","type":"git"},"_npmVersion":"11.6.2","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-value-to-ms-timestamp_11.1.0_1768758914947_0.05983003765204442","host":"s3://npm-registry-packages-npm-production"}},"12.0.0":{"name":"@adaskothebeast/http-params-processor-value-to-ms-timestamp","version":"12.0.0","description":"Millisecond timestamp output strategy for HttpParamsProcessor date values.","keywords":["http","http-params","query-string","query-params","querystring","nested-objects","serializer","typescript","value-conversion","timestamp","milliseconds","epoch","date"],"license":"MIT","author":{"name":"Adam Pluciński","email":"adaskothebeast@gmail.com","url":"https://github.com/adaskothebeast"},"repository":{"type":"git","url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git"},"bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","type":"module","sideEffects":false,"main":"./index.cjs","module":"./index.js","types":"./index.d.ts","peerDependencies":{"@adaskothebeast/http-params-processor-core":"^12.0.0"},"exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.cjs"},"./package.json":"./package.json"},"gitHead":"73d31a6c26a6f2819f6c98aabb36659532e4cdd0","_id":"@adaskothebeast/http-params-processor-value-to-ms-timestamp@12.0.0","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-Z4408DF//6czw1Ut0A/Ir4AXbssRL/S7mKF72WJxQJrRX8Vw0ac6vx9qVPAwIz3Jxrndny7MQ+3GeNzII8PqVg==","shasum":"a18132d844cf5c19148849db654220253362d061","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-to-ms-timestamp/-/http-params-processor-value-to-ms-timestamp-12.0.0.tgz","fileCount":9,"unpackedSize":12432,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIADhBShGoPpsxn5aX+aMXVMSZ9jcXTr5GHfo8yoPViVHAiAI6/NXh8Hva7F9gotMcW/5ezMM4hfKWF9gZxW8VNq/Hw=="}]},"_npmUser":{"name":"adasko","email":"adaskothebeast@gmail.com"},"directories":{},"maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/http-params-processor-value-to-ms-timestamp_12.0.0_1785236379598_0.18540200840627397"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-10T20:35:06.251Z","modified":"2026-07-28T10:59:39.933Z","10.0.0":"2026-01-10T20:35:06.798Z","11.0.0":"2026-01-18T17:42:59.950Z","11.1.0":"2026-01-18T17:55:15.099Z","12.0.0":"2026-07-28T10:59:39.742Z"},"bugs":{"url":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor/issues"},"author":{"name":"Adam Pluciński","email":"adaskothebeast@gmail.com","url":"https://github.com/adaskothebeast"},"license":"MIT","homepage":"https://github.com/AdaskoTheBeAsT/HttpParamsProcessor","repository":{"type":"git","url":"git+https://github.com/AdaskoTheBeAsT/HttpParamsProcessor.git"},"maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"readme":"# ⏲️ @adaskothebeast/http-params-processor-value-to-ms-timestamp\n\n**Millisecond timestamp output strategy for [HttpParamsProcessor](https://github.com/AdaskoTheBeAsT/HttpParamsProcessor): dates as epoch milliseconds, for example `1704067200000`.**\n\n[![npm](https://img.shields.io/npm/v/%40adaskothebeast%2Fhttp-params-processor-value-to-ms-timestamp?color=cb3837&logo=npm)](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-ms-timestamp)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n\nCore only, zero runtime dependencies. ESM + CJS. `sideEffects: false`.\n\n---\n\n## 📦 Install\n\n```bash\nnpm i @adaskothebeast/http-params-processor-value-to-ms-timestamp @adaskothebeast/http-params-processor-core\n```\n\n---\n\n## 🎯 What it does\n\nThis is a **value-to** strategy: the second half of the conversion pipeline. Pair it with a **value-from** strategy (`-value-from-luxon`, `-value-from-dayjs`, `-value-from-moment`, `-value-from-js-joda`, or the `DefaultDateValueFromStrategy` from `core`) using `createValueConverter`.\n\n| Class                        | Serializes | Example output  |\n| ---------------------------- | ---------- | --------------- |\n| `MsTimestampValueToStrategy` | `Date`     | `1704067200000` |\n\nThe output is exactly `Date.prototype.getTime()`, the number JavaScript itself uses internally. It is therefore **lossless**: feeding the string back into `new Date(Number(value))` reproduces the original instant to the millisecond. That makes it the natural choice for Node/JVM backends, Elasticsearch `epoch_millis`, and cursor style pagination where two events can share a second.\n\n---\n\n## ⚡ Usage\n\n```ts\nimport { DefaultDateValueFromStrategy, ParamsProcessor, createValueConverter } from '@adaskothebeast/http-params-processor-core';\nimport { LuxonDateTimeValueFromStrategy } from '@adaskothebeast/http-params-processor-value-from-luxon';\nimport { MsTimestampValueToStrategy } from '@adaskothebeast/http-params-processor-value-to-ms-timestamp';\nimport { DateTime } from 'luxon';\n\nconst processor = new ParamsProcessor({\n  valueConverters: [\n    createValueConverter(new LuxonDateTimeValueFromStrategy(), new MsTimestampValueToStrategy()),\n    // keep native Dates working too\n    createValueConverter(new DefaultDateValueFromStrategy(), new MsTimestampValueToStrategy()),\n  ],\n});\n\nprocessor.process('p', {\n  from: DateTime.fromISO('2024-01-01T00:00:00.123Z'),\n  to: new Date('2024-06-15T14:30:45.500Z'),\n});\n// [['p.from', '1704067200123'], ['p.to', '1718461845500']]\n```\n\nOnly dates are covered here. If the same request also carries durations or periods, register a converter for them with [`-value-to-iso`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-iso) or [`-value-to-nodatime`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-nodatime).\n\n---\n\n## 🎛️ Options and formats\n\nNo constructor options - the output is always `date.getTime()` rendered as a decimal string.\n\n| Rule              | Behaviour                                                        |\n| ----------------- | ---------------------------------------------------------------- |\n| Unit              | Whole milliseconds since `1970-01-01T00:00:00Z`                  |\n| Time zone         | None. The instant is absolute, so the local offset never appears |\n| Sub-second digits | Preserved exactly, no rounding and no truncation                 |\n| Type              | `string` (a decimal integer, no exponent notation, no `+` sign)  |\n\nCompared with the sibling [`-value-to-unix-timestamp`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-unix-timestamp) package:\n\n| Instant                    | ms-timestamp    | unix-timestamp |\n| -------------------------- | --------------- | -------------- |\n| `2024-01-01T00:00:00.000Z` | `1704067200000` | `1704067200`   |\n| `2024-01-01T00:00:00.123Z` | `1704067200123` | `1704067200`   |\n| `2024-01-01T00:00:00.999Z` | `1704067200999` | `1704067200`   |\n\n---\n\n## 📤 Output examples\n\n```text\np.from=1704067200000       # 2024-01-01T00:00:00.000Z\np.exact=1704067200123      # 2024-01-01T00:00:00.123Z, milliseconds preserved\np.to=1718461845500         # 2024-06-15T14:30:45.500Z\np.epoch=0                  # 1970-01-01T00:00:00.000Z\np.moon=-14182940000        # 1969-07-20T20:17:40.000Z, pre-epoch dates are negative\n```\n\n---\n\n## ⚠️ Edge cases\n\n- `canHandle` accepts **only real `Date` instances**. Strings such as `'2024-01-01'` and already-numeric timestamps such as `1704067200000` are rejected, so they fall through to the next converter and reach the default serialization untouched.\n- **Invalid dates** (`new Date('invalid')`) are rejected, so `NaN` never reaches the query string.\n- Pre-1970 dates serialize as negative integers. Backends that parse the parameter into an unsigned type will reject them.\n- The number is well inside `Number.MAX_SAFE_INTEGER` for any realistic date, so no precision is lost in JavaScript - but a backend that parses it into a 32-bit integer will overflow immediately, since even a present day instant needs far more than 32 bits in milliseconds.\n- The value is timezone agnostic by design. A parameter meant to be a **local calendar day** should not be an epoch timestamp; use [`-value-to-date-fns`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-date-fns) with `yyyy-MM-dd` instead.\n- Sub-millisecond precision from richer libraries (Luxon, Temporal, `js-joda` nanoseconds) is already gone by the time the value reaches this strategy, because the neutral shape handed over by every value-from strategy is a JavaScript `Date`.\n- Timestamps are opaque in logs and dashboards. If a human reads the query string, prefer [`-value-to-iso`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-iso), which is equally lossless.\n\n---\n\n## 🔗 Related packages\n\n- Inputs: [`-value-from-luxon`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-from-luxon), [`-value-from-dayjs`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-from-dayjs), [`-value-from-moment`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-from-moment), [`-value-from-js-joda`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-from-js-joda)\n- Other outputs: [`-value-to-iso`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-iso), [`-value-to-nodatime`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-nodatime), [`-value-to-unix-timestamp`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-unix-timestamp), [`-value-to-date-fns`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-date-fns)\n- Engine: [`-core`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-core)\n\nFull matrix and adapter recipes: [main README](https://github.com/AdaskoTheBeAsT/HttpParamsProcessor#readme).\n\n---\n\n## 📄 License\n\n[MIT](./LICENSE) © Adam Pluciński\n","readmeFilename":"README.md","description":"Millisecond timestamp output strategy for HttpParamsProcessor date values.","keywords":["http","http-params","query-string","query-params","querystring","nested-objects","serializer","typescript","value-conversion","timestamp","milliseconds","epoch","date"]}