forked from extern/nushell
Date utility commands (#2780)
* updated & added date related commands based on the new design * added proper error handling when date format string is invalid * fixed format issue * fixed an issue caused due to the change in primitive Date type * added `date list-timezone` command to list all supported time zones and updated `date to-timezone` accordingly
This commit is contained in:
@ -40,10 +40,9 @@ pub fn date(input: impl Into<String>) -> Value {
|
||||
let date = NaiveDate::parse_from_str(key.borrow_tagged().item, "%Y-%m-%d")
|
||||
.expect("date from string failed");
|
||||
|
||||
UntaggedValue::Primitive(Primitive::Date(DateTime::<Utc>::from_utc(
|
||||
date.and_hms(12, 34, 56),
|
||||
Utc,
|
||||
)))
|
||||
UntaggedValue::Primitive(Primitive::Date(
|
||||
DateTime::<Utc>::from_utc(date.and_hms(12, 34, 56), Utc).into(),
|
||||
))
|
||||
.into_untagged_value()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user