mirror of
https://github.com/nushell/nushell.git
synced 2025-04-17 17:58:18 +02:00
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:
parent
58f7cfd099
commit
8d5d01bbc9
@ -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 (
|
||||
|
Loading…
Reference in New Issue
Block a user