mirror of
https://github.com/nushell/nushell.git
synced 2025-01-11 16:58:41 +01:00
enable ls
to output datetime in local time vs utc (#5141)
* enable `ls` to output datetime in local time vs utc * clippy
This commit is contained in:
parent
14066ccc30
commit
791e8a0e59
@ -1,6 +1,6 @@
|
||||
use crate::DirBuilder;
|
||||
use crate::DirInfo;
|
||||
use chrono::{DateTime, Utc};
|
||||
use chrono::{DateTime, Local};
|
||||
use nu_engine::env::current_dir;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
@ -477,9 +477,9 @@ pub(crate) fn dir_entry_dict(
|
||||
if long {
|
||||
cols.push("created".to_string());
|
||||
if let Ok(c) = md.created() {
|
||||
let utc: DateTime<Utc> = c.into();
|
||||
let utc: DateTime<Local> = c.into();
|
||||
vals.push(Value::Date {
|
||||
val: utc.into(),
|
||||
val: utc.with_timezone(utc.offset()),
|
||||
span,
|
||||
});
|
||||
} else {
|
||||
@ -488,9 +488,9 @@ pub(crate) fn dir_entry_dict(
|
||||
|
||||
cols.push("accessed".to_string());
|
||||
if let Ok(a) = md.accessed() {
|
||||
let utc: DateTime<Utc> = a.into();
|
||||
let utc: DateTime<Local> = a.into();
|
||||
vals.push(Value::Date {
|
||||
val: utc.into(),
|
||||
val: utc.with_timezone(utc.offset()),
|
||||
span,
|
||||
});
|
||||
} else {
|
||||
@ -500,9 +500,9 @@ pub(crate) fn dir_entry_dict(
|
||||
|
||||
cols.push("modified".to_string());
|
||||
if let Ok(m) = md.modified() {
|
||||
let utc: DateTime<Utc> = m.into();
|
||||
let utc: DateTime<Local> = m.into();
|
||||
vals.push(Value::Date {
|
||||
val: utc.into(),
|
||||
val: utc.with_timezone(utc.offset()),
|
||||
span,
|
||||
});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user