uutils / uutils/coreutils

date - %x format specifier ignores locale settings

Open
#10,284 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

reported-launchpad U - date
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

Rust (incorrect - uses US format regardless of locale)

  $ LC_ALL=fr_FR.UTF-8 cargo run -q --features unix -- date -d '1997-01-19 08:17:48' +%x
  01/19/97
  # Uses US format MM/DD/YY instead of locale-specific format

GNU (correct - respects locale)

  $ LC_ALL=fr_FR.UTF-8 /usr/bin/date -d '1997-01-19 08:17:48' +%x
  19/01/1997
  # Uses French format DD/MM/YYYY as expected

The %x format specifier should output the locale's date representation (obtained from
nl_langinfo(D_FMT)), but uutils uses a hardcoded US format.

This also affects %X (locale time format) and %r (locale 12-hour time format) which should use
nl_langinfo(T_FMT) and nl_langinfo(T_FMT_AMPM) respectively.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the date command's handling of the %x, %X, and %r format specifiers and reproduce the issue using the LC_ALL=fr_FR.UTF-8 commands shown. Compare the output with GNU date and verify that the locale-specific date and time representations are used, including the existing Unix-feature path.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, internationalization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.