{"_id":"@adaskothebeast/http-params-processor-value-from-luxon","_rev":"3-5a3e517f8b1480c3a93728f6f6e10e62","name":"@adaskothebeast/http-params-processor-value-from-luxon","dist-tags":{"latest":"12.0.0"},"versions":{"10.0.0":{"name":"@adaskothebeast/http-params-processor-value-from-luxon","version":"10.0.0","_id":"@adaskothebeast/http-params-processor-value-from-luxon@10.0.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"dist":{"shasum":"b5c2710f035a8fdee87f87ea51bc47b7a60cc08e","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-from-luxon/-/http-params-processor-value-from-luxon-10.0.0.tgz","fileCount":19,"integrity":"sha512-/zDpRNKCNutH5zYMYHpTWItkwpkUQ3Cg9LMxzpdiqvrJxeYpNAdA85DvwXEByKinZuq0IGJCFwJl+cLRvjViDg==","signatures":[{"sig":"MEUCIQDYLY/f6Ca63szvkt44yVfHY2iX54Oxll2bRdgMyzNQfwIgGE3OFOPZJwUkf0FMw3G+8GG8g+20ZnQ4/7QbdIgfOGM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31028},"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":{"luxon":"*","@adaskothebeast/http-params-processor-core":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-value-from-luxon_10.0.0_1768077236966_0.640800851715069","host":"s3://npm-registry-packages-npm-production"}},"11.1.0":{"name":"@adaskothebeast/http-params-processor-value-from-luxon","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-from-luxon@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":"8c098b818ed49e74fee203880c8a669e04b4f868","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-from-luxon/-/http-params-processor-value-from-luxon-11.1.0.tgz","fileCount":10,"integrity":"sha512-MRdnApW13lg4BjgIBwxBdUTmJIArOzG7zsp6zXnpz2gCGGG/2Gb3iUjdncO5EETDOOF/LWBqQ9u0P01atxmuug==","signatures":[{"sig":"MEUCIQD4YD/h6rECfn0sZL4oRjqTmrwOit2OlISmLJvOD/JHWgIgKzjfPdY7Ja5QrhO7aXz/5qCPsJGcqi69P6Sh6WkJkxg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@adaskothebeast%2fhttp-params-processor-value-from-luxon@11.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":43809},"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:894cbc22-0c9c-42e7-8918-9560a2d31c44"}},"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-from-luxon_11.1.0_1768758916781_0.034623336822524386","host":"s3://npm-registry-packages-npm-production"}},"12.0.0":{"name":"@adaskothebeast/http-params-processor-value-from-luxon","version":"12.0.0","description":"Luxon DateTime and Duration input strategies for HttpParamsProcessor value conversion.","keywords":["http","http-params","query-string","query-params","querystring","nested-objects","serializer","typescript","value-conversion","luxon","datetime","duration"],"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","luxon":"^3.7.2"},"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-from-luxon@12.0.0","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-AMlfNYsrHyDUfqJj6QlehuUgLL5hh2+l5BCisRI+fMdUEaP83xSo+0b2TK1sVjM2RFw+bVsZShaikn1hWPj4WQ==","shasum":"59606512cb1f4459cd56a5215809440eaab5cc28","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-from-luxon/-/http-params-processor-value-from-luxon-12.0.0.tgz","fileCount":11,"unpackedSize":16755,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIB7uHHXKT+H3XY8eTlVdtkUpixavDG8AzzxSOKICbo3aAiAQg8ScIDY3cY4b5bEjL6Wq54SK2jdt43GMYwRMOpfJDw=="}]},"_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-from-luxon_12.0.0_1785236220181_0.8307433089211478"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-10T20:33:56.906Z","modified":"2026-07-28T10:57:00.533Z","10.0.0":"2026-01-10T20:33:57.125Z","11.1.0":"2026-01-18T17:55:16.949Z","12.0.0":"2026-07-28T10:57:00.322Z"},"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-from-luxon\n\n**Luxon input strategies for [HttpParamsProcessor](https://github.com/AdaskoTheBeAsT/HttpParamsProcessor): normalize `DateTime` and `Duration` values before they are serialized.**\n\n[![npm](https://img.shields.io/npm/v/%40adaskothebeast%2Fhttp-params-processor-value-from-luxon?color=cb3837&logo=npm)](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-from-luxon)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n\nPeer dependencies: `core` and `luxon` (`^3.7.2`). ESM + CJS. `sideEffects: false`.\n\n---\n\n## 📦 Install\n\n```bash\nnpm i @adaskothebeast/http-params-processor-value-from-luxon @adaskothebeast/http-params-processor-core luxon\n```\n\nTypeScript users also need the community typings, because Luxon ships none of its own:\n\n```bash\nnpm i -D @types/luxon\n```\n\nNo time zone data package is required - Luxon reads IANA zones from the runtime `Intl` data.\n\n---\n\n## 🎯 What it does\n\nThese are **value-from** strategies: the first half of the conversion pipeline. Each one normalizes a Luxon type into a neutral shape and must be paired with a **value-to** strategy (`-value-to-iso`, `-value-to-nodatime`, `-value-to-unix-timestamp`, `-value-to-ms-timestamp`, `-value-to-date-fns`) through `createValueConverter`.\n\n| Class                            | Accepts                                        | Produces                                                        |\n| -------------------------------- | ---------------------------------------------- | --------------------------------------------------------------- |\n| `LuxonDateTimeValueFromStrategy` | `DateTime` (detected by `DateTime.isDateTime`) | `Date` (`value.toJSDate()`)                                     |\n| `LuxonDurationValueFromStrategy` | `Duration` (detected by `Duration.isDuration`) | `DurationComponents` from `value.toObject()`, including `weeks` |\n\nLuxon is the only supported input library whose durations keep a `weeks` field, so `-value-to-iso` can emit `P2W` for it.\n\n---\n\n## ⚡ Usage\n\n```ts\nimport { DefaultDateValueFromStrategy, ParamsProcessor, createValueConverter } from '@adaskothebeast/http-params-processor-core';\nimport { LuxonDateTimeValueFromStrategy, LuxonDurationValueFromStrategy } from '@adaskothebeast/http-params-processor-value-from-luxon';\nimport { IsoDateValueToStrategy, IsoDurationValueToStrategy } from '@adaskothebeast/http-params-processor-value-to-iso';\nimport { DateTime, Duration } from 'luxon';\n\nconst processor = new ParamsProcessor({\n  valueConverters: [\n    createValueConverter(new LuxonDateTimeValueFromStrategy(), new IsoDateValueToStrategy()),\n    createValueConverter(new LuxonDurationValueFromStrategy(), new IsoDurationValueToStrategy()),\n    // keep native Dates working too\n    createValueConverter(new DefaultDateValueFromStrategy(), new IsoDateValueToStrategy()),\n  ],\n});\n\nprocessor.process('p', {\n  from: DateTime.fromISO('2024-01-15T10:30:00Z'),\n  window: Duration.fromObject({ hours: 1, minutes: 30, seconds: 45 }),\n});\n// [['p.from', '2024-01-15T10:30:00.000Z'], ['p.window', 'PT1H30M45S']]\n```\n\n---\n\n## 🎛️ Options and configuration\n\nNeither strategy takes constructor options - both are stateless and safe to share between processors.\n\n**Zones collapse into an instant.** `toJSDate()` keeps the moment in time and drops the zone metadata, so `DateTime.fromISO('2024-01-15T10:30:00', { zone: 'America/New_York' })` becomes `2024-01-15T15:30:00.000Z`. If you need the wall-clock rendering instead, pair the strategy with [`-value-to-date-fns`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-date-fns) and a local format, or convert with `.setZone('utc', { keepLocalTime: true })` first.\n\n**Durations are passed through as authored.** Luxon does not carry units for you, so the components you built the `Duration` with are the components that get serialized. Call `.shiftTo(...)` or `.normalize()` yourself when the backend expects a carried form:\n\n```ts\nDuration.fromObject({ minutes: 90 }).shiftTo('hours', 'minutes');\n// { hours: 1, minutes: 30 } -> PT1H30M\n```\n\n**Output format** is decided by the paired value-to strategy - swap `IsoDateValueToStrategy` for `UnixTimestampValueToStrategy`, `MsTimestampValueToStrategy` or a NodaTime writer without touching the from side.\n\n---\n\n## 📤 Output examples\n\nPaired with `-value-to-iso`:\n\n| Value passed to `process`                                               | Normalized shape                             | Serialized                 |\n| ----------------------------------------------------------------------- | -------------------------------------------- | -------------------------- |\n| `DateTime.fromISO('2024-01-15T10:30:00Z')`                              | `Date` (instant)                             | `2024-01-15T10:30:00.000Z` |\n| `DateTime.fromISO('2024-01-15T10:30:00', { zone: 'America/New_York' })` | `Date` (instant)                             | `2024-01-15T15:30:00.000Z` |\n| `Duration.fromObject({ hours: 1, minutes: 30 })`                        | `{ hours: 1, minutes: 30 }`                  | `PT1H30M`                  |\n| `Duration.fromObject({ minutes: 90 })`                                  | `{ minutes: 90 }`                            | `PT90M`                    |\n| `Duration.fromObject({ weeks: 2 })`                                     | `{ weeks: 2 }`                               | `P2W`                      |\n| `Duration.fromISO('PT1.5S')`                                            | `{ seconds: 1, milliseconds: 500 }`          | `PT1.5S`                   |\n| `Duration.fromMillis(5400000)`                                          | `{ milliseconds: 5400000 }`                  | `PT5400S`                  |\n| `Duration.fromObject({ years: 1, months: 2, days: 3, hours: 4 })`       | `{ years: 1, months: 2, days: 3, hours: 4 }` | `P1Y2M3DT4H`               |\n\n```text\np.from    = 2024-01-15T10:30:00.000Z\np.window  = PT1H30M45S\n```\n\n---\n\n## ⚠️ Edge cases\n\n- **Invalid values still pass `canHandle`.** `DateTime.isDateTime` is `true` for `DateTime.invalid(...)` and for anything built from unparsable input, so the value is claimed and normalized to `Invalid Date`; `IsoDateValueToStrategy` then throws `RangeError: Invalid time value` (timestamp writers emit `NaN`). Check `.isValid` before building your params object.\n- An invalid `Duration` normalizes to an empty object, which the ISO writer renders as `PT0S` rather than failing loudly.\n- Zero components are converted to `undefined`, so `Duration.fromObject({ hours: 0, minutes: 5 })` serializes as `PT5M`.\n- **`Duration.fromMillis` is not exploded.** `toObject()` returns a single `milliseconds` field, and the ISO writer folds it into seconds (`PT5400S`). Use `.shiftTo('hours', 'minutes')` when you want `PT1H30M`.\n- Fractional components are preserved verbatim: `Duration.fromObject({ weeks: 1.5 })` becomes `P1.5W`, which strict backends may reject.\n- Luxon `Interval` is **not** supported; split it into `interval.start` / `interval.end` (both `DateTime`) or into `interval.toDuration()`.\n- `Duration` values are not instants, so never pair `LuxonDurationValueFromStrategy` with a date writer - the converter runs whichever writer you paired, it does not re-check the shape.\n- `DateTime` and `Duration` detection never overlap, so both converters can be registered in any order; keep `DefaultDateValueFromStrategy` in the list if plain `Date` values also travel through the same processor.\n\n---\n\n## 🔗 Related packages\n\n- 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-ms-timestamp`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-ms-timestamp), [`-value-to-date-fns`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-date-fns)\n- Other inputs: [`-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- 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":"Luxon DateTime and Duration input strategies for HttpParamsProcessor value conversion.","keywords":["http","http-params","query-string","query-params","querystring","nested-objects","serializer","typescript","value-conversion","luxon","datetime","duration"]}