Fix improper application of local timezone offset to Unix epochs (#15283)

Fix failing test by ignoring the local offset when converting times, but still displaying the
resulting date in the local timezone (including applicable DST offset).

# User-Facing Changes

Fix: Unix Epochs now convert consistently regardless of whether DST is
in effect in the local timezone or not.
This commit is contained in:
Douglas 2025-03-11 11:57:37 -04:00 committed by GitHub
parent 58f7cfd099
commit 8d5d01bbc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -408,13 +408,10 @@ fn action(input: &Value, args: &Arguments, head: Span) -> Value {
Err(reason) => {
match NaiveDateTime::parse_from_str(val, &dt.0) {
Ok(d) => {
let local_offset = *Local::now().offset();
let dt_fixed =
TimeZone::from_local_datetime(&local_offset, &d)
.single()
.unwrap_or_default();
Local.from_local_datetime(&d).single().unwrap_or_default();
Value::date (dt_fixed,head)
Value::date(dt_fixed.into(),head)
}
Err(_) => {
Value::error (