ntfy icon indicating copy to clipboard operation
ntfy copied to clipboard

Format Date per user locale

Open omar2205 opened this issue 1 year ago • 2 comments

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

omar2205 avatar Nov 08 '22 13:11 omar2205

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

binwiederhier avatar Nov 08 '22 19:11 binwiederhier

Yeah the web app

omar2205 avatar Nov 09 '22 03:11 omar2205

@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?

binwiederhier avatar Nov 27 '22 17:11 binwiederhier

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

omar2205 avatar Nov 27 '22 17:11 omar2205

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

KhaaL avatar Jan 22 '24 16:01 KhaaL