Moment: Starting with lowercase or uppercase letter

Created on 29 Jan 2015  ·  3Comments  ·  Source: moment/moment

In some languages the sentences start with a lowercase letter and in some languages the sentences start with an uppercase letter.
I think we should for consistency choose one of the two for every language (where appropriate).

Current lowercase examples:
Dutch - gisteren om 00:07
Frisian - juster om 00:07
Turkish - dün 00:07

Current uppercase examples:
English - Yesterday at 12:07 AM
Afrikaans - Gister om 00:07
Luxembourgish - Gëschter um 0:07 Auer

I think we should go for lowercase, as those are not really sentences.
If you want to use them midsentence I would recommend a function like PHP's ucfirst.

Most helpful comment

I actually disagree and think we should go with a proper title-case. It's really easy to do:

moment(...).format("MMM").toLowerCase()

to get a lower case value than it is to do:

var date = moment(...).format("MMM")
date = date[0].toUpperCase() + date.substr(1)

All that to say, I think the locales are being consistent with the language's grammar, but I'm not really a linguist.

All 3 comments

I actually disagree and think we should go with a proper title-case. It's really easy to do:

moment(...).format("MMM").toLowerCase()

to get a lower case value than it is to do:

var date = moment(...).format("MMM")
date = date[0].toUpperCase() + date.substr(1)

All that to say, I think the locales are being consistent with the language's grammar, but I'm not really a linguist.

This is another discussed topic. To make it work properly there needs to be a way for locales to specify which letters' case might be changed, and then the format function should supply a lower/upper/normal case flag.

This is not happening anytime soon, so for now you're better off doing some string hacks on the output for particular languages.

Imho it is better NOT to have titlecase than to have it, because it is always safe to make the first character uppercase, and the opposite is not true.

If the locale uses lowercase, then:

  • I can use calendar() at the beginning of a sentence by making the first char uppercase. (*)
  • I can use calendar() within a sentence.

If the locale uses titlecase, then:

  • I can use calendar() at the beginning of a sentence.
  • I can use calendar() within a sentence by manually identifying the relevant strings (this can be hard) and making their first char lowercase. (*)

(*) As far as I know. See https://en.wikipedia.org/wiki/Capitalization for more details.

Possibly, it might make sense to decide about it on per-locale basis. Each locale should document its decision then.

This also relates to my PR: https://github.com/moment/moment/pull/2422

Was this page helpful?
0 / 5 - 0 ratings