diff --git a/boa_engine/src/builtins/date/mod.rs b/boa_engine/src/builtins/date/mod.rs index 9460229aa0..d6d6d43dd6 100644 --- a/boa_engine/src/builtins/date/mod.rs +++ b/boa_engine/src/builtins/date/mod.rs @@ -1634,7 +1634,12 @@ impl Date { // 4. Let t be LocalTime(tv). // 5. Return DateString(t). if let Some(t) = tv.0 { - Ok(t.format("%a %b %d %Y").to_string().into()) + Ok(Local::now() + .timezone() + .from_utc_datetime(&t) + .format("%a %b %d %Y") + .to_string() + .into()) } else { Ok(JsString::from("Invalid Date").into()) } diff --git a/boa_engine/src/builtins/date/tests.rs b/boa_engine/src/builtins/date/tests.rs index 7a2eebdacd..057fd576fd 100644 --- a/boa_engine/src/builtins/date/tests.rs +++ b/boa_engine/src/builtins/date/tests.rs @@ -1199,7 +1199,7 @@ fn date_proto_to_string() { Some(JsValue::new( Local .from_local_datetime(&NaiveDateTime::new( - NaiveDate::from_ymd(2020, 6, 8), + NaiveDate::from_ymd(2020, 7, 8), NaiveTime::from_hms_milli(9, 16, 15, 779) )) .earliest() @@ -1225,7 +1225,7 @@ fn date_proto_to_time_string() { Some(JsValue::new( Local .from_local_datetime(&NaiveDateTime::new( - NaiveDate::from_ymd(2020, 6, 8), + NaiveDate::from_ymd(2020, 7, 8), NaiveTime::from_hms_milli(9, 16, 15, 779) )) .earliest()