Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the number 1 instead of the word "ein" for formatDuration in German locale #2505

Closed
Tracked by #2600
thexpand opened this issue Jun 7, 2021 · 5 comments · Fixed by #2576
Closed
Tracked by #2600

Using the number 1 instead of the word "ein" for formatDuration in German locale #2505

thexpand opened this issue Jun 7, 2021 · 5 comments · Fixed by #2576

Comments

@thexpand
Copy link

thexpand commented Jun 7, 2021

Hello. I tried using formatDuration to calculate a duration based on an interval. When I try it without a locale (i.e. in English) the result that I get is e.g. "1 year 1 month 15 days". However, when I add the German locale and try to format the same interval, I get "ein Jahr ein Monat 15 Tage". I am not a native German speaker, but it's strange that it does it only to number 1. It doesn't happen to other numbers, e.g. "2". Is there a reason why this is the behavior or is it a bug?

EDIT: My current workaround is to do a replace formattedString.replace(/ein/g, '1')

@kossnocorp
Copy link
Member

As I can see in CLDR, using numbers is the correct way. @date-fns/i18n-de could you please chime in?

@saithis
Copy link
Contributor

saithis commented Jun 14, 2021

Embedded into a longer text up to and including 12, it should be written as eins, zwei, ... zwölf. Alone standing i think 1 is correct (or at least thats how most people do it). But from my observation many (mostly younger) people always use "1" instead of "ein" , even in a longer text.

If you don't know where it will he used and have to decide one way or the other, I think "1" is better than "ein", even though it will trigger some grammar nazis.

edit: I lokked it up and the rule that up to 12 should be written as a word isn't true anymore. You can still do it but digits are always allowed now.

@janziemba
Copy link
Contributor

janziemba commented Aug 5, 2021

I have created a PR. Does it make sense? #2576

@pex
Copy link
Member

pex commented Sep 12, 2021

@saithis is right afaik - there is not an official rule two write 1-12 as a word.
On the other hand there is something special about the number 1: it is the only number that is pronounced and written differently when used with a subject.

1   | Eins    | Eine Minute
2   | Zwei    | Zwei Minuten
50  | Fünfzig | Fünfzig Minuten

1   | Eins    | Ein Monat
2   | Zwei    | Zwei Monate
50  | Fünfzig | Fünfzig Monate

This may be the reason why the number 1 is currently an exception.
Personally I must say having this exception feels more natural. "Eins Minute" is just wrong.

kossnocorp pushed a commit that referenced this issue Sep 17, 2021
…an locale (#2576) (closes #2505)

Changed: Used `1` instead of `ein` for German `formatDuration` to make it consistent with other locales and formats.
tan75 pushed a commit to janziemba/date-fns that referenced this issue Dec 27, 2021
…an locale (date-fns#2576) (closes date-fns#2505)

Changed: Used `1` instead of `ein` for German `formatDuration` to make it consistent with other locales and formats.
@Havock94
Copy link

Hello, I just noticed Italian locale has the same "issue" if we can call it like that, it uses the string "un" when the unit is 1, the number otherwise.

I see the PR for the German locale has been accepted, should we use it as a rule to always use numbers for durations? In that case I'd open a PR for the Italian locale.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants