dateutils icon indicating copy to clipboard operation
dateutils copied to clipboard

Not able to use dconv for some months

Open aborruso opened this issue 4 years ago • 5 comments

Hi, if I run echo "aprile" | dconv --from-locale it_IT -i "%B" | dateconv -f "%m" I have 04.

If I choose "luglio" - july in Italian - and run echo "luglio" | dconv --from-locale it_IT -i "%B", I have

dconv: cannot make sense of `luglio' using the given input formats

What's wrogn in my command?

I'm using dateconv 0.4.7.git21.0a82108.

Thank you

aborruso avatar Oct 14 '21 16:10 aborruso

Hi Andrea,

thanks for the report. You can have a long explanation or a short work around:

$ echo "luglio 1" | dconv --from-locale it_IT -i "%B %d"
2021-07-01

The problem is an optimisation for the sed-mode (-S) that does not like text-only specifiers in conjunction with custom locales.

hroptatyr avatar Oct 15 '21 09:10 hroptatyr

Thank you very much.

But why does it work for "aprile"?

aborruso avatar Oct 15 '21 09:10 aborruso

The details are a bit complex but dconv looks for (a static set of) letters/characters that demark month names. This set is optimised for the English month names. If, however, numeric specifieres are in the format string it prefers those.

hroptatyr avatar Oct 15 '21 09:10 hroptatyr

I have closed the issue, because your solution works for my goal.

please choose whether to leave it open

aborruso avatar Oct 15 '21 09:10 aborruso

I know, thank you. I might try and fix it though.

hroptatyr avatar Oct 15 '21 10:10 hroptatyr