hroptatyr / dateutils

nifty command line date and time utilities; fast date calculations and conversion in the shell
http://www.fresse.org/dateutils/
Other
612 stars 40 forks source link

%a, %A, %b, and %B ignore locale #100

Closed NoSuck closed 5 years ago

NoSuck commented 5 years ago

I am back again. Is this a bug?

Observed:

■ dateconv --locale ja_JP.utf8 -f %A 2019-04-18
Thursday
■ dateconv --from-locale ja_JP.utf8 -i %a 木
dconv: cannot make sense of `木' using the given input formats
■ dateconv --from-locale ja_JP.utf8 -i %a Thu
2019-04-18

Expected:

■ dateconv --locale ja_JP.utf8 -f %A 2019-04-18
木曜日
■ dateconv --from-locale ja_JP.utf8 -i %a 木
2019-04-18
■ dateconv --from-locale ja_JP.utf8 -i %a Thu
dconv: cannot make sense of `Thu' using the given input formats

The %b and %B format specifiers exhibit similar behavior. Thank you for reading.

hroptatyr commented 5 years ago

Hiya, thanks for the report.

Again, using dateutils 0.4.6 (and opensuse 42.1), I get:

$ dateconv --locale ja_JP.utf8 -f %A 2019-04-18
木曜日
$ dateconv --from-locale ja_JP -i %a 木
2019-04-18
$ dateconv --from-locale ja_JP -i %a Thu
dconv: cannot make sense of `Thu' using the given input formats

So it appears to me that you'd have to leave out the encoding bit (.utf8) though this is highly system-specific. If you could try that and report back I'd be grateful. Locale support is a rather recent innovation and quite contrary to my philosophy (which is not to depend on platform details).

NoSuck commented 5 years ago

Thank you for the helpful and quick response. Everything looks good here!

■ dateconv --locale ja_JP -f %A 2019-04-18
木曜日
■ dateconv --from-locale ja_JP -i %a 木
2019-04-18
■ dateconv --from-locale ja_JP -i %a Thu
dconv: cannot make sense of `Thu' using the given input formats