bigeasy / timezone

Full-blown timezone aware date math and formatting for JavaScript in 2.7k.
http://bigeasy.github.io/timezone
MIT License
255 stars 26 forks source link

Missing Meridiems for french and spanish #331

Closed JackHowa closed 1 year ago

JackHowa commented 3 years ago

I noticed that the merdiems for fr_FR.js and es_ES.js were missing. This led to potentially confusing date formatting if the user elected to use 12-hour time for the hour but in a language without merdiem values for am, pm. In perhaps a strange edge case, Paris (GMT+1) and Auckland (GMT+13) had the same output with 12-hour hour markers.

@bigeasy Let me know if this library is still being maintained. I would be happy to help out with a solution if so.

For example,

const date = '2000-01-02 01:00'

// French-speaking in New Zealand
const tz = require('timezone')(require('timezone/Pacific/Auckland'), require('timezone/fr_FR'),)

const utc = tz(date)
console.log( tz(date, 'fr_FR', 'Pacific/Auckland', '%B %d, %Y %l:%M %P %Z'))
// janvier 02, 2000  2:00  NZDT
// would expect janvier 02, 2000  2:00 pm  NZDT
const date = '2000-01-02 01:00'

// French-speaking parisian
const tz = require('timezone')(require('timezone/fr_FR'), require('timezone/Europe/Paris'),)

const utc = tz(date)
console.log( tz(date, 'fr_FR, 'Europe/Paris', '%B %d, %Y %l:%M %P %Z'))
// janvier 02, 2000  2:00  CET
// would expect janvier 02, 2000  2:00 am  CET
  "meridiem": [
    "",
    ""
  ],
JackHowa commented 3 years ago

@bigeasy is this library still maintained? I can close this if so

bigeasy commented 3 years ago

No, no. It's still maintained. Maybe I'll do some maintenance tonight. These i18n files are generated by parsing GNU date output so if it is missing here, it is missing there (or was at the time of generation.) I'll look at your pull request and see what I can do about improving the contribution documentation. The build problems you're having ought to be easy to resolve.

JackHowa commented 3 years ago

thanks for looking at the pr. let me know if I can do anything. appreciate your work on this project @bigeasy

JackHowa commented 3 years ago

closing this due to inactivity

JackHowa commented 3 years ago

let me know if you have time for this @bigeasy in the review https://github.com/bigeasy/timezone/pull/336

bigeasy commented 3 years ago

Jack,

I am so sorry for not responding sooner. I am also sorry to say this, given the time you've waited and the effort you've expended, but I don't think it is applicable to languages that do not have a concept of AM/PM. The localization is auto-generated from an inspection of the output of GNU date. GNU date does not specify meridiem for France, for example, and from what I can tell the French do not expect to see it.

https://french.stackexchange.com/questions/26804/am-pm-in-french-digital-clock/26811#26811

My plan was to follow the lead of GNU Date and defer to it for localization. The localization files are auto generated. This seems like something that would be easier to maintain in the long term.

Do you have an application where users are using French localization and have selected am/pm?

JackHowa commented 3 years ago

@bigeasy thanks for the response. We have been asked by Spanish-speaking users so far (also missing). I can't speak to cultural uses of this in France or elsewhere. Yet we do want to offer flexibility to customers since the library offers meridiem customization for whatever norms users may want to follow. Does that make sense?

bigeasy commented 3 years ago

How do Spanish speakers choose the AM/PM. I assume you're not asking users to formulate a date format string.

JackHowa commented 3 years ago

we are, yep. going off of https://bigeasy.github.io/timezone/#section-52

If there's nothing else, is it ok if I close it?