jacobwb / hashover-next

This branch will be HashOver 2.0
GNU Affero General Public License v3.0
420 stars 87 forks source link

Date and time localization #337

Open nsuomine opened 1 year ago

nsuomine commented 1 year ago

If I understand correctly, dates and times should be localized automatically according to the language setting. But if I set the language to de-de, it seems that times are still using the format 1:20 pm instead 13:20.

I also tried to override time-format and time-pattern settings when creating hashOver object but I was not able to change the time format to 24h. Probably, I am doing something wrong.

jacobwb commented 1 year ago

This sounds like you are missing the Intl module. If you don't have this module installed the dates don't get localized automatically, instead you will need to change a setting to use 24 hour time manually. You can do this on the Admin Settings page, you can also change the format for the 24 hour time there as well.

You can enable 24 hour time from the frontend, but you cannot change the formatting of the time from the frontend because that would be an XSS vulnerability.

Let me know if you continue having issues getting 24 hour time working.

On Sat, Nov 19, 2022, 7:03 AM nsuomine @.***> wrote:

If I understand correctly, dates and times should be localized automatically according to the language setting. But if I set the language to de-de, it seems that times are still using the format 1:20 pm instead 13:20.

I also tried to override time-format and time-pattern settings when creating hashOver object but I was not able to change the time format to 24h. Probably, I am doing something wrong.

— Reply to this email directly, view it on GitHub https://github.com/jacobwb/hashover-next/issues/337, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDV75XC3R3SKKADTMHZ2YTWJDT2NANCNFSM6AAAAAASFLM6FU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

nsuomine commented 1 year ago

Thank you. I try first to install the module.

I need to change the behaviour from the fronted because my site is multilingual. Intl module seems to be the only way then?

nsuomine commented 1 year ago

Thank you. I try first to install the module.

I need to change the behaviour from the fronted because my site is multilingual. Intl module seems to be the only way then?

I checked that I have the Intl module installed but still the format is incorrect. Because the site is bilingual, the date format should change according to the language. On my CMS, I can modify page templates to pass parameters to the Hashover object. Managing backend settings is not a solution because that would affect all pages.

nsuomine commented 1 year ago

Unfortunately, I have not been able to get time and date localization working. I have the intl module activated from my hosting provider.

No matter which language setting I specify, there is always a 12-hour time format. Not sure how to debug if the intl module is working. My site is bilingual so I can use static formatting settings.