date - %x format specifier ignores locale settings
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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