mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
fix: 修复 date_to_json 测试时区敏感断言(UTC+8 下用显式 UTC 时间戳)
This commit is contained in:
@@ -109,7 +109,8 @@ fn date_to_iso_string() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn date_to_json() {
|
fn date_to_json() {
|
||||||
let mut vm = Vm::new();
|
let mut vm = Vm::new();
|
||||||
let r = eval(&mut vm, "new Date(2020, 0, 1).toJSON()").unwrap();
|
// Parse an explicit ISO UTC string to avoid timezone dependency
|
||||||
|
let r = eval(&mut vm, "new Date('2020-01-01T00:00:00Z').toJSON()").unwrap();
|
||||||
let s = str_val(&vm, r);
|
let s = str_val(&vm, r);
|
||||||
assert!(s.starts_with("2020-01-01"), "got: {s}");
|
assert!(s.starts_with("2020-01-01"), "got: {s}");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user