Closed FabienHenon closed 7 years ago
What format string are you using and what is the expected result verse the actual result you receive ?
Here is an example on Ellie that might make it easier for you to provide an example. https://ellie-app.com/47J5ZYs396Fa1/4
In my timezone the result is.
1 => Hour(24): 22 Hour(12): 10 Suffix: [PM] offset: +1000 2 => Hour(24): 01 Hour(12): 01 Suffix: [AM] offset: +1000
I just reread your description and maybe you are saying the defaults for french you don't believe are accurate ?
The file Config_fr_fr.elm defines the standard formats. This is the current values of the format strings.
format =
{ date = "%-d/%m/%Y" -- d/MM/yyyy
, longDate = "%A, %-d %B %Y" -- dddd, d MMMM yyyy
, time = "%-I:%M %p" -- h:mm tt
, longTime = "%-I:%M:%S %p" -- h:mm:ss tt
, dateTime = "%-d/%m/%Y %-I:%M %p" -- date + time
, firstDayOfWeek = Date.Mon
}
Sorry for my late answer.
Yes, the defaults are not correct. Here is my updated version (note that I couldn't access the Default
module for the twelveHourPeriod
variable):
frenchConfig : Config.Config
frenchConfig =
{ i18n =
{ dayShort = French.dayShort
, dayName = French.dayName
, monthShort = French.monthShort
, monthName = French.monthName
, dayOfMonthWithSuffix = French.dayOfMonthWithSuffix
, twelveHourPeriod = (\a -> "")
}
, format =
{ date =
"%-d/%m/%Y"
-- d/MM/yyyy
, longDate =
"%A, %-d %B %Y"
-- dddd, d MMMM yyyy
, time =
"%-H:%M"
-- h:mm tt
, longTime =
"%-H:%M:%S"
-- h:mm:ss tt
, dateTime =
"%-d/%m/%Y %-H:%M"
-- date + time
, firstDayOfWeek = Date.Mon
}
}
As you can see, I'm using %H
for hours and not %I
and I don't use %P
any more because in France we only use 24h format ;)
By the way, what is the -
(hyphen) used for between %
and the format letter?
The doc for the formatting codes is at https://github.com/rluiten/elm-date-extra/blob/master/DocFormat.md.
The link to DocFormat use to work on elm site but I dont think it works anymore elm, I will look at correcting that with this update.
The -
prefix means the the number is output as 1 or 2 digits, no padding zeros to always make it 2 digits.
Just checked Moment.js french format and they use 2 digits for hours, so I'll modify that as well.
The updated french config is published in 9.1.2.
Hi,
First, thank you for this great package!
I used the french (from France fr_fr) locale to display my date and times but there is a little error in the format: french times are displayed on 24 hours without AM/PM.