Skip to content

Commit 2204255

Browse files
committed
fix typing error
1 parent 3701624 commit 2204255

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

Diff for: @xen-orchestra/web-core/lib/components/ui/task-item/UiTaskItem.vue

+16-13
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import { vTooltip } from '@core/directives/tooltip.directive'
5353
import type { Message, Task, TaskStatus } from '@core/types/task.type.ts'
5454
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons'
5555
import { useTimeAgo } from '@vueuse/core'
56+
import type { UseTimeAgoMessages } from '@vueuse/core'
5657
import { computed } from 'vue'
5758
import { useI18n } from 'vue-i18n'
5859

@@ -65,21 +66,23 @@ const { t } = useI18n()
6566

6667
const taskTimeStatus = computed(() => task.end ?? task.start ?? new Date())
6768

69+
const messages: UseTimeAgoMessages = {
70+
justNow: t('just-now'),
71+
past: (n: string) => (/\d/.test(n) ? t('ago', [n]) : n),
72+
future: (n: string) => (/\d/.test(n) ? t('in', [n]) : n),
73+
month: (n, past) => (n === 1 ? (past ? t('last-month') : t('next-month')) : `${n} ${t(`month${n > 1 ? 's' : ''}`)}`),
74+
year: (n, past) => (n === 1 ? (past ? t('last-year') : t('next-year')) : `${n} ${t(`year${n > 1 ? 's' : ''}`)}`),
75+
day: (n, past) => (n === 1 ? (past ? t('yesterday') : t('tomorrow')) : `${n} ${t(`day${n > 1 ? 's' : ''}`)}`),
76+
week: (n, past) => (n === 1 ? (past ? t('last-week') : t('next-week')) : `${n} ${t(`week${n > 1 ? 's' : ''}`)}`),
77+
hour: n => `${n} ${t(`hour${n > 1 ? 's' : ''}`)}`,
78+
minute: n => `${n} ${t(`minute${n > 1 ? 's' : ''}`)}`,
79+
second: n => `${n} ${t(`second${n > 1 ? 's' : ''}`)}`,
80+
invalid: 'Invalid',
81+
}
82+
6883
const timeAgo = useTimeAgo(taskTimeStatus, {
6984
fullDateFormatter: (date: Date) => date.toLocaleDateString(),
70-
messages: {
71-
justNow: t('just-now'),
72-
past: (n: any) => (n.match(/\d/) ? t('ago', [n]) : n),
73-
future: (n: any) => (n.match(/\d/) ? t('in', [n]) : n),
74-
month: (n, past) =>
75-
n === 1 ? (past ? t('last-month') : t('next-month')) : `${n} ${t(`month${n > 1 ? 's' : ''}`)}`,
76-
year: (n, past) => (n === 1 ? (past ? t('last-year') : t('next-year')) : `${n} ${t(`year${n > 1 ? 's' : ''}`)}`),
77-
day: (n, past) => (n === 1 ? (past ? t('yesterday') : t('tomorrow')) : `${n} ${t(`day${n > 1 ? 's' : ''}`)}`),
78-
week: (n, past) => (n === 1 ? (past ? t('last-week') : t('next-week')) : `${n} ${t(`week${n > 1 ? 's' : ''}`)}`),
79-
hour: n => `${n} ${t(`hour${n > 1 ? 's' : ''}`)}`,
80-
minute: n => `${n} ${t(`minute${n > 1 ? 's' : ''}`)}`,
81-
second: n => `${n} ${t(`second${n > 1 ? 's' : ''}`)}`,
82-
},
85+
messages,
8386
})
8487

8588
const taskIsComplete = computed(() => {

Diff for: @xen-orchestra/web-core/lib/locales/en.json

+1
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@
507507
"you-are-currently-on": "You are currently on: {0}",
508508
"zstd": "zstd",
509509

510+
"datetime-format": "YY-MM-DD hh:mm:ss",
510511
"just-now": "just now",
511512
"ago": "{0} ago",
512513
"in": "in {0}",

Diff for: @xen-orchestra/web-core/lib/locales/fr.json

+1
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@
507507
"you-are-currently-on": "Vous êtes actuellement sur : {0}",
508508
"zstd": "zstd",
509509

510+
"datetime-format": "DD/MM/YY hh:mm:ss",
510511
"just-now": "maintenant",
511512
"ago": "il y a {0}",
512513
"in": "dans {0}",

0 commit comments

Comments
 (0)