Temporal on v26.x: until() and round() add one smallestUnit to a whole number of years, months or weeks (temporal_rs 0.2.3)
Maintainer thường phản hồi trong vòng 1 ngày
@tanveer-arch đang làm issue này rồi.
Từ ngày 14/11/2026.
- #67474 của @Renegade334 — đã đóng, không merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, rust
- Lĩnh vực
- backend
Hướng nghiên cứu
The pin is in deps/crates/Cargo.toml (temporal_rs 0.2.3). The window bug lives upstream in compute_nudge_window in src/builtins/core/duration/normalized.rs, so the fix is a dependency bump to 0.2.4 or later, or a cherry-pick of boa-dev/temporal#723. Start by reproducing the five console.log cases from the issue on a Node build. Done when they print P1Y, P3Y, P1Y, P1M and P1W, and the test262 exact-multiple-of-larger-unit tests pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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");
const opts = (roundingMode, smallestUnit = "months") => ({ largestUnit: "years", smallestUnit, roundingMode });
console.log(start.until("2001-01-01", opts("halfExpand")).toString());
console.log(start.until("2003-01-01", opts("ceil")).toString());
console.log(start.until("2001-01-01", opts("ceil", "weeks")).toString());
console.log(Temporal.Duration.from("P31D").round({ largestUnit: "months", smallestUnit: "weeks", roundingMode: "ceil", relativeTo: "2012-01-01" }).toString());
console.log(Temporal.Duration.from("P7D").round({ largestUnit: "weeks", smallestUnit: "days", relativeTo: "2024-11-01T00:00:00+00:00[UTC]" }).toString());
How often does it reproduce? Is there a required condition?
Every 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.
What is the expected behavior? Why is that the expected behavior?
P1Y
P3Y
P1Y
P1M
P1W
Each 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.
What do you see instead?
P1Y1M
P3Y1M
P1Y1W
P1M1W
P1W1D
Each result has one extra unit of smallestUnit.
Additional information
The 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.
- Spec: tc39/proposal-temporal#3316, fixed by tc39/proposal-temporal#3319.
- test262: tc39/test262@a70493eb104948583a7928d50eac28b6c81114bf adds
exact-multiple-of-larger-unit*.jsforDuration.prototype.roundand forsinceanduntilonPlainDate,PlainDateTime,PlainYearMonthandZonedDateTime. - temporal_rs: boa-dev/temporal#723, first released in 0.2.4.
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.
Edited 2026-11-13: narrowed "How often" to the cases that give a wrong result.
- Ngôn ngữ chính
- JavaScript
- Star
- 124k
- Fork
- 38k
- Merge trung bình
- 4 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 266
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nodejs/node
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Maintainer thường phản hồi trong vòng 1 ngày
-
fs: document readStream.start and readStream.endCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởdoc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
nodejs/node#67848 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
doc: document the Buffer.prototype.*Slice() methodsCó thể đã có người làm @AyushCipher đã nhận hôm nay. Đang mởdoc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
nodejs/node#67847 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`styleText` fast path bypasses `options` and `options.validateStream` validationCó thể đã có người làm @GBra-4-669 đã nhận 8 ngày trước. Đang mởutil
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
riscv64
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nodejs/node#67655 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
bug triage needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Resource]: PersephoneĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
hesreallyhim/awesome-claude-code#3773 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
tabatkins/railroad-diagrams#129 ·
-
web: api() turns a null or object-valued error body into a TypeError or "[object Object]" and loses the statusCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
OCM: shares using the `embedded` protocol are rejected with "Missing sharedSecret in protocol"Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày