Description
The -u flag doesn't work correctly for:
- Pure digit strings (e.g.,
date -u -d "12")
--reference option
--resolution option
Output shows local timezone instead of UTC.
Reproduction
Run in non-UTC timezone:
# Bug #1: Pure digits
$ date -u -d "12" "+%Z"
BST # Expected: UTC
# Bug #2: --reference
$ touch /tmp/testfile
$ date -u --reference /tmp/testfile "+%Z"
BST # Expected: UTC
# Bug #3: --resolution
$ date -u --resolution "+%Z"
BST # Expected: UTC
Cause
src/uu/date/src/date.rs:
- Line 279:
--reference always uses TimeZone::try_system()
- Line 285:
--resolution always uses TimeZone::system()
- Line 461:
parse_date() ignores timezone offset in parsed string
None check the settings.utc flag.
Description
The
-uflag doesn't work correctly for:date -u -d "12")--referenceoption--resolutionoptionOutput shows local timezone instead of UTC.
Reproduction
Run in non-UTC timezone:
Cause
src/uu/date/src/date.rs:--referencealways usesTimeZone::try_system()--resolutionalways usesTimeZone::system()parse_date()ignores timezone offset in parsed stringNone check the
settings.utcflag.