|
| 1 | +<!-- |
| 2 | + - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
| 3 | + - SPDX-License-Identifier: AGPL-3.0-or-later |
| 4 | +--> |
| 5 | + |
| 6 | +<template> |
| 7 | + <pre>{{ snapshotString }}</pre> |
| 8 | +</template> |
| 9 | + |
| 10 | +<script setup lang="ts"> |
| 11 | +import { getDateFormat, getDateRangeFormat, getDateTimeFormat, getDateTimeRangeFormat, getMonthFormat, getTimeFormat, getTimeRangeFormat, getYearFormat } from '../../../../src/components/NcDateTimePicker/format.ts' |
| 12 | +import allLocales from './allLocales.ts' |
| 13 | +
|
| 14 | +const date = new Date(2000, 0, 2, 3, 4) |
| 15 | +const dateRange = [new Date(2000, 0, 1), new Date(2000, 0, 7)] |
| 16 | +const timeRange = [new Date(2000, 0, 1, 2, 3), new Date(2000, 0, 1, 8, 9)] |
| 17 | +const dateTimeRange = [new Date(2000, 0, 1, 2, 3), new Date(2000, 0, 7, 8, 9)] |
| 18 | +
|
| 19 | +const snapshot = { |
| 20 | +
|
| 21 | +} |
| 22 | +
|
| 23 | +for (const locale of allLocales) { |
| 24 | + const localeCode = locale.code.replaceAll('_', '-') |
| 25 | + if (Intl.DateTimeFormat.supportedLocalesOf([localeCode]).length === 0) { |
| 26 | + continue |
| 27 | + } |
| 28 | + snapshot[localeCode] = { |
| 29 | + localeName: locale.name, |
| 30 | + date: getDateFormat(localeCode)(date), |
| 31 | + dateRange: getDateRangeFormat(localeCode)(dateRange), |
| 32 | + time: getTimeFormat(localeCode)(date), |
| 33 | + timeRange: getTimeRangeFormat(localeCode)(timeRange), |
| 34 | + dateTime: getDateTimeFormat(localeCode)(date), |
| 35 | + dateTimeRange: getDateTimeRangeFormat(localeCode)(dateTimeRange), |
| 36 | + month: getMonthFormat(localeCode)(date), |
| 37 | + year: getYearFormat(localeCode)(date), |
| 38 | + } |
| 39 | +} |
| 40 | +
|
| 41 | +const snapshotString = JSON.stringify(snapshot, null, 2) |
| 42 | +</script> |
0 commit comments