mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-16 23:28:44 +01:00
feat(ui): format dates using the selected language (#6160)
Dates were rendered with the browser locale, ignoring the language chosen in Personal settings, so a user browsing in German still saw US-style dates. All date rendering now resolves its locale through a useDateLocale hook that returns the selected language, augmented with the region from navigator.languages when the language carries none (Intl reads a bare "en" as en-US). Applied to DateField, the rated/loved tooltips, the mobile user list and album release dates; the three inline timestamp tooltips now share a formatDateTime helper. Closes #229
This commit is contained in:
parent
fed35e08de
commit
be8ec15168
9 changed files with 115 additions and 7 deletions
|
|
@ -95,6 +95,9 @@ export const formatFullDate = (date, locale) => {
|
|||
return new Date(date).toLocaleDateString(locale, options)
|
||||
}
|
||||
|
||||
export const formatDateTime = (value, locale) =>
|
||||
new Date(value).toLocaleString(locale)
|
||||
|
||||
export const formatNumber = (value, locale) => {
|
||||
if (value === null || value === undefined) return '0'
|
||||
return value.toLocaleString(locale)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue