Skip to content

date input: bare timezone abbreviations (ut, UT, gmt, …) rejected #280

Closed

Description

@sylvestre

Summary

GNU date -d accepts bare timezone abbreviations (UT, ut, GMT, gmt, …) and interprets them as "now, expressed in that timezone". parse_datetime rejects them as invalid.

Found by a fuzz_date run on uutils/coreutils.

Reproduction

$ TZ=UTC+1 /usr/bin/date -d 'ut' '+%Z'
UTC

$ TZ=UTC+1 target/debug/coreutils date -d 'ut' '+%Z'
date: invalid date 'ut'
$ echo $?
1

$ TZ=UTC+1 /usr/bin/date -d 'GMT' '+%Z'
UTC

$ TZ=UTC+1 target/debug/coreutils date -d 'GMT' '+%Z'
date: invalid date 'GMT'

Test (in uutils/coreutils integration suite)

#[test]
fn test_date_bare_timezone_abbreviation() {
    for input in ["ut", "UT", "gmt", "GMT"] {
        new_ucmd!()
            .env("TZ", "UTC+1")
            .arg("-d")
            .arg(input)
            .arg("+%Z")
            .succeeds()
            .stdout_is("UTC\n");
    }
}

Activity

  1. added
    bug
    good first issue
    on Apr 5, 2026
  2. added 2 commits that reference this issue on Apr 6, 2026
    94b5cb1
    bdfb04b
  3. added 2 commits that reference this issue on Jun 7, 2026
    1682c03
    3561676
  4. added a commit that references this issue on Jul 5, 2026
    516a3a9
  5. xtqqczze commented on Oct 12, 2026

    @xtqqczze
    Contributor

    @anastygnome Is there anything in this issue that remains unaddressed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions