Title: Temporal on v26.x: until() and round() add one smallestUnit to a whole number of years, months or weeks (temporal_rs 0.2.3) · Issue #67457 · nodejs/node · GitHub
Open Graph Title: Temporal on v26.x: until() and round() add one smallestUnit to a whole number of years, months or weeks (temporal_rs 0.2.3) · Issue #67457 · nodejs/node
X Title: Temporal on v26.x: until() and round() add one smallestUnit to a whole number of years, months or weeks (temporal_rs 0.2.3) · Issue #67457 · nodejs/node
Description: Version v26.13.1 (V8 14.6.202.34-node.40). Also v26.12.1 and v26.13.0. Platform Darwin 27.0.0 arm64 Subsystem temporal, deps/crates (temporal_rs) What steps will reproduce the bug? const start = Temporal.PlainDate.from("2000-01-01"); con...
Open Graph Description: Version v26.13.1 (V8 14.6.202.34-node.40). Also v26.12.1 and v26.13.0. Platform Darwin 27.0.0 arm64 Subsystem temporal, deps/crates (temporal_rs) What steps will reproduce the bug? const start = Te...
X Description: Version v26.13.1 (V8 14.6.202.34-node.40). Also v26.12.1 and v26.13.0. Platform Darwin 27.0.0 arm64 Subsystem temporal, deps/crates (temporal_rs) What steps will reproduce the bug? const start = Te...
Opengraph URL: https://github.com/nodejs/node/issues/67457
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Temporal on v26.x: until() and round() add one smallestUnit to a whole number of years, months or weeks (temporal_rs 0.2.3)","articleBody":"### Version\n\nv26.13.1 (V8 14.6.202.34-node.40). Also v26.12.1 and v26.13.0.\n\n### Platform\n\n```text\nDarwin 27.0.0 arm64\n```\n\n### Subsystem\n\ntemporal, deps/crates (temporal_rs)\n\n### What steps will reproduce the bug?\n\n```js\nconst start = Temporal.PlainDate.from(\"2000-01-01\");\nconst opts = (roundingMode, smallestUnit = \"months\") => ({ largestUnit: \"years\", smallestUnit, roundingMode });\n\nconsole.log(start.until(\"2001-01-01\", opts(\"halfExpand\")).toString());\nconsole.log(start.until(\"2003-01-01\", opts(\"ceil\")).toString());\nconsole.log(start.until(\"2001-01-01\", opts(\"ceil\", \"weeks\")).toString());\nconsole.log(Temporal.Duration.from(\"P31D\").round({ largestUnit: \"months\", smallestUnit: \"weeks\", roundingMode: \"ceil\", relativeTo: \"2012-01-01\" }).toString());\nconsole.log(Temporal.Duration.from(\"P7D\").round({ largestUnit: \"weeks\", smallestUnit: \"days\", relativeTo: \"2024-11-01T00:00:00+00:00[UTC]\" }).toString());\n```\n\n### How often does it reproduce? Is there a required condition?\n\nEvery time the result is a whole number of a larger unit, so the smallest unit comes out as 0, `smallestUnit` is `months` or `weeks` (or `days` from a `ZonedDateTime`), and the rounding mode can round up (`ceil`, `expand` or one of the `half` modes). `trunc` and `floor` give the right result, and so does `smallestUnit: \"days\"` from a `PlainDate` or `PlainDateTime`. `PlainDateTime`, `ZonedDateTime` and `since` are affected in the same way, in every calendar.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n```text\nP1Y\nP3Y\nP1Y\nP1M\nP1W\n```\n\nEach end is exactly one or three years, one month or one week after the start, so there is nothing left to round up. Chromium 153.0.8010.12 and WebKit 26.6 print these five lines.\n\n### What do you see instead?\n\n```text\nP1Y1M\nP3Y1M\nP1Y1W\nP1M1W\nP1W1D\n```\n\nEach result has one extra unit of `smallestUnit`.\n\n### Additional information\n\nThe cause is in temporal_rs 0.2.3, which `deps/crates/Cargo.toml` pins on v26.x. When it builds the rounding window, it checks only whether the smallest unit is 0, not whether the whole duration is 0, so the window starts at the origin instead of at the end of the whole years, months or weeks.\n\n- Spec: tc39/proposal-temporal#3316, fixed by tc39/proposal-temporal#3319.\n- test262: tc39/test262@a70493eb104948583a7928d50eac28b6c81114bf adds `exact-multiple-of-larger-unit*.js` for `Duration.prototype.round` and for `since` and `until` on `PlainDate`, `PlainDateTime`, `PlainYearMonth` and `ZonedDateTime`.\n- temporal_rs: boa-dev/temporal#723, first released in 0.2.4.\n\n`main` pins 0.2.6, which has the fix. Could v26.x move to temporal_rs 0.2.4 or later, the way #64543 brought it to 0.2.3, or take boa-dev/temporal#723 on its own? The change is in `compute_nudge_window` in `src/builtins/core/duration/normalized.rs`.\n\n_Edited 2026-11-13: narrowed \"How often\" to the cases that give a wrong result._\n","author":{"url":"https://github.com/craig-o-curtis","@type":"Person","name":"craig-o-curtis"},"datePublished":"2026-11-13T15:50:12Z","url":"https://github.com/nodejs/node/issues/67457"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1a3ecff8-6c48-b3ec-37c1-737891182917 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 96C2:1FAD:111BBB3:16B9707:6B033638 |
| html-safe-nonce | 4d536daef7b5bc3a1a7daf4963547395d2c6e9a797f2b8155631ba93cafbfe3f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkMyOjFGQUQ6MTExQkJCMzoxNkI5NzA3OjZCMDMzNjM4IiwidmlzaXRvcl9pZCI6IjMwMTc1MzY3NDg1NjY4MjA0MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cfa4ce95eb51a0ca93fa9514ea1fb90213148075f3d3ce5e0274c51406012b47 |
| hovercard-subject-tag | issue:6374849757 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/67457/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7c134fb22c3045b334b8bf2d886e7cd398bc2d96acb3152375e7ea087ab8a004/nodejs/node/issues/67457 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7c134fb22c3045b334b8bf2d886e7cd398bc2d96acb3152375e7ea087ab8a004/nodejs/node/issues/67457 |
| og:image:alt | Version v26.13.1 (V8 14.6.202.34-node.40). Also v26.12.1 and v26.13.0. Platform Darwin 27.0.0 arm64 Subsystem temporal, deps/crates (temporal_rs) What steps will reproduce the bug? const start = Te... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | craig-o-curtis |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width