File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
277277 // TODO - Revisit when chrono 0.5 is released. https://github.com/chronotope/chrono/issues/970
278278 let tz = match std:: env:: var ( "TZ" ) {
279279 // TODO Support other time zones...
280- Ok ( s) if s == "UTC0" => Tz :: Etc__UTC ,
280+ Ok ( s) if s == "UTC0" || s . is_empty ( ) => Tz :: Etc__UTC ,
281281 _ => match get_timezone ( ) {
282282 Ok ( tz_str) => tz_str. parse ( ) . unwrap ( ) ,
283283 Err ( _) => Tz :: Etc__UTC ,
Original file line number Diff line number Diff line change @@ -482,3 +482,12 @@ fn test_date_from_stdin() {
482482 Sat Apr 15 18:30:00 UTC 2023\n ",
483483 ) ;
484484}
485+
486+ #[ test]
487+ fn test_date_empty_tz ( ) {
488+ new_ucmd ! ( )
489+ . env ( "TZ" , "" )
490+ . arg ( "+%Z" )
491+ . succeeds ( )
492+ . stdout_only ( "UTC\n " ) ;
493+ }
You can’t perform that action at this time.
0 commit comments