fix: 本地日期分量换算改走本地时区映射并消除负索引溢出

This commit is contained in:
2026-09-20 19:55:07 +00:00
parent c9e1ee2e09
commit d750d4a2b5
4 changed files with 163 additions and 80 deletions
@@ -91,3 +91,10 @@ fn set_full_year_on_invalid_date_uses_epoch() {
let s = eval_str("String((function() { var d = new Date(NaN); return d.setFullYear(2016) === new Date(2016, 0, 1).getTime(); })())").unwrap();
assert_eq!(s, "true");
}
// 有限巨负起点:截断饱和成 isize::MIN 后归一化到 0,debug 构建不得取负溢出。
#[test]
fn typed_array_fill_finite_negative_huge_start() {
let s = eval_str("new Uint8Array(4).fill(0, -1e300).join(',')").unwrap();
assert_eq!(s, "0,0,0,0");
}