@xen-orchestra/web-core 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/{charts/LinearChart.md → linear-chart/VtsLinearChart.md} +3 -3
- package/lib/components/{charts/LinearChart.vue → linear-chart/VtsLinearChart.vue} +12 -11
- package/lib/components/quick-info-card/VtsQuickInfoCard.vue +29 -0
- package/lib/components/quick-info-column/VtsQuickInfoColumn.vue +13 -0
- package/lib/components/quick-info-row/VtsQuickInfoRow.vue +40 -0
- package/lib/components/ui/card/UiCard.vue +12 -0
- package/lib/components/ui/radio-button/UiRadioButton.vue +1 -1
- package/lib/components/ui/toaster/UiToaster.vue +6 -2
- package/lib/composables/chart-theme.composable.ts +2 -2
- package/lib/composables/relative-time.composable.md +18 -0
- package/lib/composables/relative-time.composable.ts +66 -0
- package/lib/i18n.ts +12 -0
- package/lib/locales/cs.json +49 -17
- package/lib/locales/de.json +233 -24
- package/lib/locales/en.json +58 -2
- package/lib/locales/es.json +42 -10
- package/lib/locales/fa.json +208 -6
- package/lib/locales/fr.json +58 -2
- package/lib/locales/it.json +178 -0
- package/lib/locales/ru.json +91 -0
- package/lib/locales/sv.json +25 -0
- package/lib/locales/uk.json +1 -0
- package/lib/utils/time.util.ts +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { utcParse } from 'd3-time-format'
|
|
2
|
+
|
|
3
|
+
export function parseDateTime(dateTime: Date | string | number): number {
|
|
4
|
+
if (typeof dateTime === 'number') {
|
|
5
|
+
return dateTime
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (dateTime instanceof Date) {
|
|
9
|
+
return dateTime.getTime()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
dateTime = dateTime.replace(/(-|\.\d{3})/g, '') // Allow toISOString() date-time format
|
|
13
|
+
const date = utcParse('%Y%m%dT%H:%M:%SZ')(dateTime)
|
|
14
|
+
if (date === null) {
|
|
15
|
+
throw new RangeError(`unable to parse XAPI datetime ${JSON.stringify(dateTime)}`)
|
|
16
|
+
}
|
|
17
|
+
return date.getTime()
|
|
18
|
+
}
|