frontend: fixed alignment of dates for any language (hopefully)
Massimo Melina committed
Feb 25, 2023 at 21:26 UTC
34630e41d9e45d4e3b3a0fedcf1c1b10ed4b977f
1 file changed
+5
-1
frontend/src/BrowseFiles.ts
+5
-1
@@ -217,6 +217,7 @@ const EntryProps = memo((entry: DirEntry & { midnight: Date }) => {
217
const today = time && time > entry.midnight
218
const shortTs = isMobile()
219
const {t} = useI18N()
220
+ const dd = '2-digit'
221
return h('div', { className: 'entry-props' },
222
useCustomCode('additionalEntryProps', { entry }),
223
h(EntrySize, { s }),
@@ -226,7 +227,10 @@ const EntryProps = memo((entry: DirEntry & { midnight: Date }) => {
227
if (shortTs)
228
alertDialog(t`Full timestamp:` + "\n" + time.toLocaleString()).then()
229
}
229
- }, !shortTs ? time.toLocaleString() : today ? time.toLocaleTimeString() : time.toLocaleDateString()),
230
+ }, time.toLocaleString(navigator.language, {
231
+ ...!shortTs || !today ? { year: shortTs ? dd : 'numeric', month: dd, day: dd } : null,
232
+ ...!shortTs || today ? { hour: dd, minute: dd } : null,
233
+ })),
234
)
235
})
236