binwiederhier / ntfy

Send push notifications to your phone or desktop using PUT/POST
https://ntfy.sh
Apache License 2.0
17.77k stars 691 forks source link

Format Date per user locale #475

Closed omar2205 closed 1 year ago

omar2205 commented 1 year ago

To have the date as 11/8/22, 2:58 PM is very American. Can you please convert it to user locale? or an option in settings

binwiederhier commented 1 year ago

In the Android app? It should be using the user locale. Or are you talking about the web app?

omar2205 commented 1 year ago

Yeah the web app

binwiederhier commented 1 year ago

@omar2205 So I checked the code and message dates are formatted using https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat, in this function:

export const formatShortDateTime = (timestamp) => {
    return new Intl.DateTimeFormat('default', {dateStyle: 'short', timeStyle: 'short'})
        .format(new Date(timestamp * 1000));
}

The docs say that using default is using the browser's default locale. I tested this by switching my Firefox to German, and the date format switched to the German date format as well.

@omar2205 Can you elaborate what browser you are using, and what your language settings in the browser are? Maybe show screenshots?

omar2205 commented 1 year ago

I was hoping for an option in the settings to change the format.

KhaaL commented 7 months ago

Hi! I see this is implemented via https://github.com/binwiederhier/ntfy/issues/700 - but I see no setting to adjust the date format on the webapp on ntfy.sh. Is this feature only visible for self-hosted versions? There is no mention of this feature beyond the release notes for v. 2.7.0