mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-27 13:48:52 +02:00
[GH-1080] Use current locale for date range (#1575)
This uses the currently configured locale to compute the value of date range table aggregations. Previously, it would fall back to the browser locale (or English) and ignore the locale configured in Focalboard itself. Relates to: #1080 Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
parent
85ffb63b91
commit
14634fd4e8
@ -282,7 +282,7 @@ function getTimestampsFromPropertyValue(value: number | string | string[]): numb
|
||||
return []
|
||||
}
|
||||
|
||||
function dateRange(cards: readonly Card[], property: IPropertyTemplate): string {
|
||||
function dateRange(cards: readonly Card[], property: IPropertyTemplate, intl: IntlShape): string {
|
||||
const resultEarliest = earliestEpoch(cards, property)
|
||||
if (resultEarliest === Number.POSITIVE_INFINITY) {
|
||||
return ''
|
||||
@ -291,7 +291,7 @@ function dateRange(cards: readonly Card[], property: IPropertyTemplate): string
|
||||
if (resultLatest === Number.NEGATIVE_INFINITY) {
|
||||
return ''
|
||||
}
|
||||
return moment.duration(resultLatest - resultEarliest, 'milliseconds').humanize()
|
||||
return moment.duration(resultLatest - resultEarliest, 'milliseconds').locale(intl.locale.toLowerCase()).humanize()
|
||||
}
|
||||
|
||||
const Calculations: Record<string, (cards: readonly Card[], property: IPropertyTemplate, intl: IntlShape) => string> = {
|
||||
|
Loading…
Reference in New Issue
Block a user