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

Wrong plural usage for time in PT-BR #3988

Open
viniciusbm opened this issue May 31, 2017 · 3 comments · May be fixed by #5404
Open

Wrong plural usage for time in PT-BR #3988

viniciusbm opened this issue May 31, 2017 · 3 comments · May be fixed by #5404

Comments

@viniciusbm
Copy link

There is a problem with the following definitions for Brazilian Portuguese:

    longDateFormat : {
        LT : 'HH:mm',
        LTS : 'HH:mm:ss',
        L : 'DD/MM/YYYY',
        LL : 'D [de] MMMM [de] YYYY',
        LLL : 'D [de] MMMM [de] YYYY [às] HH:mm',
        LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm'
    },
    calendar : {
        sameDay: '[Hoje às] LT',
        nextDay: '[Amanhã às] LT',
        nextWeek: 'dddd [às] LT',
        lastDay: '[Ontem às] LT',
        lastWeek: function () {
            return (this.day() === 0 || this.day() === 6) ?
                '[Último] dddd [às] LT' : // Saturday + Sunday
                '[Última] dddd [às] LT'; // Monday - Friday
        },
        sameElse: 'L'
    }

The string "às" should only be used if the hour (in 24-hour format) is at least 2. If H == 0 or H == 1, "à" should be used instead.

I managed to find a solution for the calendar part (I only tested this by extending the locale with updateLocale):

    calendar:  {
        sameDay: function() { return '[Hoje] ' + (this.hours() < 2 ? '[à]' : '[às]') + ' LT'; },
        nextDay: function() { return '[Amanhã] ' + (this.hours() < 2 ? '[à]' : '[às]') + ' LT'; },
        nextWeek: function() { return 'dddd ' + (this.hours() < 2 ? '[à]' : '[às]') + ' LT'; },
        lastDay: function() { return '[Ontem] ' + (this.hours() < 2 ? '[à]' : '[às]') + ' LT'; },
        lastWeek: function () {
            return (this.day() === 0 || this.day() === 6) ?
                '[Último] dddd ' + (this.hours() < 2 ? '[à]' : '[às]') + ' LT': // Saturday + Sunday
                '[Última] dddd ' + (this.hours() < 2 ? '[à]' : '[às]') + ' LT'; // Monday - Friday
        },
        sameElse: 'L'
    }

However, I cannot do the same with longDateFormat, because its values apparently cannot be functions.

Is there a solution for this (by either editing pt_br.js or extending the locale externally)?

Thank you

@icambron
Copy link
Member

I guess we'd need a code change to allow them to be functions

@robbporto
Copy link

robbporto commented Sep 4, 2018

As a brazilian, I don't understand what is the problem here...

I think it's correct to say: "Hoje às 00:00" or "Hoje às 01:00", right?

@viniciusbm
Copy link
Author

Wrong.

In “à(s) xx:00” — which is read as “à(s) xx hora(s)” —, the “à(s)” is a contraction of the preposition “a” with the article “a(s)”. The article refers to “xx hora(s)”, so it cannot be plural if xx is less than 2. Therefore, we must say “à 0 hora”, “à 1 hora”, “às 2 horas”, “às 3 horas”, and so on.

For the same reason, if we want to say the current time (“it’s...”), we must use “é” (and not “são”) before “zero hora”, “uma hora”, “meio-dia” and “meia-noite”.

If you have questions about this topic, I recommend checking some grammar, such as Moderna Gramática Portuguesa by Evanildo Bechara.

I’m Brazilian too, and I know that even in Brazil it’s common to hear these expressions used incorrectly. However, I think Moment.js should still display them properly.

luizcorreia added a commit to luizcorreia/moment that referenced this issue Mar 5, 2020
@luizcorreia luizcorreia linked a pull request Mar 5, 2020 that will close this issue
luizcorreia added a commit to luizcorreia/moment that referenced this issue Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants