{"_id":"@adaskothebeast/http-params-processor-value-from-js-joda","_rev":"4-3115bdc23297cc57335d4b194244bb50","name":"@adaskothebeast/http-params-processor-value-from-js-joda","dist-tags":{"latest":"12.0.0"},"versions":{"10.0.0":{"name":"@adaskothebeast/http-params-processor-value-from-js-joda","version":"10.0.0","_id":"@adaskothebeast/http-params-processor-value-from-js-joda@10.0.0","maintainers":[{"name":"adasko","email":"adaskothebeast@gmail.com"}],"dist":{"shasum":"01c1eab47af7f4af8922a3b62df5a32f47eb7e72","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-from-js-joda/-/http-params-processor-value-from-js-joda-10.0.0.tgz","fileCount":23,"integrity":"sha512-e52tpuSah9rMLAuM1qJUtR+rq/F8BP0TQ0/mlqfciz4FvobrOIvmc7Cx2jqkXOyt/AC8dgoSykkK+qKMTaNUsQ==","signatures":[{"sig":"MEUCIQC9bkt1jXSO8y6ev3WMmZI8hD3iAcVwVmDb1GzhxYFVngIgYxDTxDrMkmNIATug1afhSOqrSJB85EIPARiSHbZ7iZ8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34402},"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":{"@js-joda/core":"*","@adaskothebeast/http-params-processor-core":"^10.0.0"},"_npmOperationalInternal":{"tmp":"tmp/http-params-processor-value-from-js-joda_10.0.0_1768077220691_0.021567713723263715","host":"s3://npm-registry-packages-npm-production"}},"11.0.0":{"name":"@adaskothebeast/http-params-processor-value-from-js-joda","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-from-js-joda@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":"0440aa3b74c2ed0768f4786960b0c09efbcdb878","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-from-js-joda/-/http-params-processor-value-from-js-joda-11.0.0.tgz","fileCount":12,"integrity":"sha512-wyjL9lyrcT0LBDFD0mu3TmfO/JkjfYYu9Fyx2QdEkUB+qwE5rc5U16dodb0iFbwLA8eiPaEGshW1uq4Ls/ahmg==","signatures":[{"sig":"MEYCIQD6YX1+rD0HVQBfib1xhpmkR/rjCheQKH4M6MvVF99YeAIhAONnH3+Z59dt63lEVpUL+cB3lmYi8JlcYy06OUHQ6aXj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@adaskothebeast%2fhttp-params-processor-value-from-js-joda@11.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":45029},"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:b39e9e22-49c0-4326-9735-d147065958df"}},"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-js-joda_11.0.0_1768758176399_0.2091092212247483","host":"s3://npm-registry-packages-npm-production"}},"11.1.0":{"name":"@adaskothebeast/http-params-processor-value-from-js-joda","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-js-joda@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":"afb5898a4a0dd445af014a76d810e080a594c43a","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-from-js-joda/-/http-params-processor-value-from-js-joda-11.1.0.tgz","fileCount":12,"integrity":"sha512-+hdgshDAGrfW+yoOGvyN2a1MYorNIf1HtRwOe7gWXKWzJDRMBXaDLQeJvHkVRT6jcJyLwi+qE9Softe2Qqbesg==","signatures":[{"sig":"MEUCIQCFJhU54jIAcFt3aNhT0BYp/9GNmbfmJrRn9wC7aOawCwIgZ/TxbyV8MqqO3S7zEgGfmWYMW9sK9s0/Q1hinw9S994=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@adaskothebeast%2fhttp-params-processor-value-from-js-joda@11.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":45029},"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:b39e9e22-49c0-4326-9735-d147065958df"}},"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-js-joda_11.1.0_1768758916755_0.5339350211411908","host":"s3://npm-registry-packages-npm-production"}},"12.0.0":{"name":"@adaskothebeast/http-params-processor-value-from-js-joda","version":"12.0.0","description":"js-joda date, duration and period input strategies for HttpParamsProcessor value conversion.","keywords":["http","http-params","query-string","query-params","querystring","nested-objects","serializer","typescript","value-conversion","js-joda","localdate","duration","period"],"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","@js-joda/core":"^6.1.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-from-js-joda@12.0.0","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-K3LjYg4UYRrkSpazsnQzwaV+T29qd/2qeXKjCYxjvLoX3JlbdgLjYwk/I/xDYA+0nwXS4+b3PWqOl0sjUvki9w==","shasum":"1d7f63d8b197b310a7ebb14254c88b79ad239a16","tarball":"https://registry.npmjs.org/@adaskothebeast/http-params-processor-value-from-js-joda/-/http-params-processor-value-from-js-joda-12.0.0.tgz","fileCount":13,"unpackedSize":20947,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIESAor/B7AdGeZkBQCIwPaCPkh7A780J8z92Ynrq2HpbAiBEYVtLMJ0gUeUJSxLlMp1iIkBUyu1H3x1J+vkELdW+kQ=="}]},"_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-js-joda_12.0.0_1785236201394_0.801480340922883"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-10T20:33:40.591Z","modified":"2026-07-28T10:56:41.765Z","10.0.0":"2026-01-10T20:33:40.855Z","11.0.0":"2026-01-18T17:42:56.537Z","11.1.0":"2026-01-18T17:55:16.899Z","12.0.0":"2026-07-28T10:56:41.551Z"},"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-js-joda\n\n**js-joda input strategies for [HttpParamsProcessor](https://github.com/AdaskoTheBeAsT/HttpParamsProcessor): normalize `LocalDate`, `LocalDateTime`, `ZonedDateTime`, `Duration` and `Period` values before they are serialized.**\n\n[![npm](https://img.shields.io/npm/v/%40adaskothebeast%2Fhttp-params-processor-value-from-js-joda?color=cb3837&logo=npm)](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-from-js-joda)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n\nPeer dependencies: `core` and `@js-joda/core` (`^6.1.0`). ESM + CJS. `sideEffects: false`.\n\n---\n\n## 📦 Install\n\n```bash\nnpm i @adaskothebeast/http-params-processor-value-from-js-joda @adaskothebeast/http-params-processor-core @js-joda/core\n```\n\nAdd the time zone database as well if you pass `ZonedDateTime` values built from IANA zone ids - `@js-joda/core` alone only knows UTC, fixed offsets and the system zone:\n\n```bash\nnpm i @js-joda/timezone\n```\n\n---\n\n## 🎯 What it does\n\nThese are **value-from** strategies: the first half of the conversion pipeline. Each one normalizes a js-joda 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| `JsJodaLocalDateValueFromStrategy` | `LocalDate`, `LocalDateTime`, `ZonedDateTime` (`instanceof`) | `Date` (`convert(value).toDate()`)                                      |\n| `JsJodaDurationValueFromStrategy`  | `Duration` (`instanceof`)                                    | `DurationComponents` with `hours`, `minutes`, `seconds`, `milliseconds` |\n| `JsJodaPeriodValueFromStrategy`    | `Period` (`instanceof`)                                      | `PeriodComponents` with `years`, `months`, `days`                       |\n\njs-joda is the only supported input library that separates a **`Duration`** (exact time, always rendered as hours and below) from a **`Period`** (calendar amount, always rendered as years, months and days), which maps one-to-one onto the two neutral shapes in `core`.\n\n---\n\n## ⚡ Usage\n\n```ts\nimport { ParamsProcessor, createValueConverter } from '@adaskothebeast/http-params-processor-core';\nimport { JsJodaDurationValueFromStrategy, JsJodaLocalDateValueFromStrategy, JsJodaPeriodValueFromStrategy } from '@adaskothebeast/http-params-processor-value-from-js-joda';\nimport { IsoDateValueToStrategy, IsoDurationValueToStrategy, IsoPeriodValueToStrategy } from '@adaskothebeast/http-params-processor-value-to-iso';\nimport { Duration, LocalDateTime, Period } from '@js-joda/core';\n\nconst processor = new ParamsProcessor({\n  valueConverters: [createValueConverter(new JsJodaLocalDateValueFromStrategy(), new IsoDateValueToStrategy()), createValueConverter(new JsJodaPeriodValueFromStrategy(), new IsoPeriodValueToStrategy()), createValueConverter(new JsJodaDurationValueFromStrategy(), new IsoDurationValueToStrategy())],\n});\n\nprocessor.process('p', {\n  from: LocalDateTime.of(2024, 1, 15, 10, 30, 45),\n  window: Duration.ofHours(2).plusMinutes(30),\n  term: Period.of(1, 2, 3),\n});\n// p.from is the instant of 2024-01-15T10:30:45 in the system zone\n// p.window = 'PT2H30M', p.term = 'P1Y2M3D'\n```\n\n---\n\n## 🎛️ Options and configuration\n\nNo strategy takes constructor options - all three are stateless and safe to share between processors.\n\n**Local types are resolved in the system zone.** `convert(value).toDate()` is called without an explicit zone, so a `LocalDate` becomes local midnight and a `LocalDateTime` becomes that local wall-clock time. With the ISO writer (which always emits UTC) `LocalDate.of(2024, 1, 15)` in `Europe/Warsaw` serializes as `2024-01-14T23:00:00.000Z`. If you need the calendar date to survive verbatim, either send `localDate.toString()` as a plain string or convert to a `ZonedDateTime` in UTC yourself:\n\n```ts\nimport { LocalDate, ZoneOffset } from '@js-joda/core';\n\nLocalDate.of(2024, 1, 15).atStartOfDay(ZoneOffset.UTC);\n// -> 2024-01-15T00:00:00.000Z\n```\n\n**`ZonedDateTime` keeps the instant**, so the zone or offset it was built with is applied correctly and then dropped.\n\n**Register the period converter before the duration converter** if both are in play. They cannot collide on js-joda values (`instanceof` checks are exact), but the ISO writers detect the neutral shapes structurally, so keeping the period pair first matches the ordering recommended by [`-value-to-iso`](https://www.npmjs.com/package/@adaskothebeast/http-params-processor-value-to-iso).\n\n---\n\n## 📤 Output examples\n\nPaired with `-value-to-iso`:\n\n| Value passed to `process`                     | Normalized shape                   | Serialized                                      |\n| --------------------------------------------- | ---------------------------------- | ----------------------------------------------- |\n| `LocalDate.of(2024, 1, 15)`                   | `Date` (local midnight)            | `2024-01-14T23:00:00.000Z` (in `Europe/Warsaw`) |\n| `LocalDateTime.of(2024, 1, 15, 10, 30, 45)`   | `Date` (local wall clock)          | `2024-01-15T09:30:45.000Z` (in `Europe/Warsaw`) |\n| `ZonedDateTime.parse('2024-01-15T10:30:00Z')` | `Date` (instant)                   | `2024-01-15T10:30:00.000Z`                      |\n| `Duration.ofHours(2).plusMinutes(30)`         | `{ hours: 2, minutes: 30 }`        | `PT2H30M`                                       |\n| `Duration.ofMinutes(90)`                      | `{ hours: 1, minutes: 30 }`        | `PT1H30M`                                       |\n| `Duration.ofDays(2)`                          | `{ hours: 48 }`                    | `PT48H`                                         |\n| `Duration.ZERO`                               | `{}`                               | `PT0S`                                          |\n| `Period.of(1, 2, 3)`                          | `{ years: 1, months: 2, days: 3 }` | `P1Y2M3D`                                       |\n| `Period.ofMonths(20)`                         | `{ months: 20 }`                   | `P20M`                                          |\n| `Period.ofWeeks(3)`                           | `{ days: 21 }`                     | `P21D`                                          |\n| `Period.ZERO`                                 | `{}`                               | `P0D`                                           |\n\n```text\np.window  = PT2H30M\np.term    = P1Y2M3D\n```\n\n---\n\n## ⚠️ Edge cases\n\n- **Durations never carry days or larger.** The strategy reads the total seconds and splits them into hours, minutes and seconds, so `Duration.ofDays(2)` becomes `PT48H`, not `P2D`. That is faithful to js-joda semantics (a `Duration` is exact time), but backends expecting `P2D` need a `Period` instead.\n- **Sub-millisecond precision is lost.** Nanoseconds are truncated towards zero (`Math.floor(nano / 1_000_000)`), so `Duration.ofNanos(1_500_000)` normalizes to `{ milliseconds: 1 }` and anything below 1 ms disappears.\n- **Negative durations are not supported.** The component split assumes a non-negative amount, so `Duration.ofMinutes(-90)` normalizes to `{ hours: -2, minutes: -30 }`, which serializes as `PT-2H-30M` instead of a 90 minute deficit. Send `duration.abs()` and pass the sign as a separate parameter.\n- **Periods are never normalized.** `Period.ofMonths(20)` stays `P20M` (js-joda only carries months into years when you call `normalized()`), and weeks are folded into days at construction time, so a `weeks` field is never emitted.\n- Zero components are converted to `undefined`; `Duration.ZERO` yields `PT0S` and `Period.ZERO` yields `P0D`.\n- **No invalid-value trap.** js-joda throws while constructing an out-of-range value, so unlike Moment, Day.js or Luxon there is no \"invalid\" object that can slip through `canHandle` and produce `Invalid Date`.\n- `Instant`, `OffsetDateTime`, `LocalTime`, `YearMonth` and `MonthDay` are **not** handled. Wrap them first (for example `instant.atZone(ZoneOffset.UTC)`) or send `value.toString()` as a plain string.\n- Detection is `instanceof`, so values crossing a realm boundary (iframe, worker, or two copies of `@js-joda/core` in the dependency tree) are not recognized. Keep a single hoisted `@js-joda/core` version.\n- A `Duration` or `Period` is not an instant; never pair those strategies with a date writer such as `IsoDateValueToStrategy` - the converter always runs the paired writer, it does not re-check the shape.\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-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)\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":"js-joda date, duration and period input strategies for HttpParamsProcessor value conversion.","keywords":["http","http-params","query-string","query-params","querystring","nested-objects","serializer","typescript","value-conversion","js-joda","localdate","duration","period"]}