diff --git a/web/src/lib/components/admin-settings/SupportedDatetimePanel.svelte b/web/src/lib/components/admin-settings/SupportedDatetimePanel.svelte index de455380a9..c22d3cb792 100644 --- a/web/src/lib/components/admin-settings/SupportedDatetimePanel.svelte +++ b/web/src/lib/components/admin-settings/SupportedDatetimePanel.svelte @@ -11,85 +11,38 @@ let { options }: Props = $props(); - const getLuxonExample = (format: string) => { - return DateTime.fromISO('2022-02-15T20:03:05.250Z', { locale: $locale }).toFormat(format); - }; + const getExampleDate = () => DateTime.fromISO('2022-02-15T20:03:05.250Z', { locale: $locale }); +{#snippet example(title: string, options: Array)} +
+ {title} + +
+{/snippet} + {$t('date_and_time')} - {$t('admin.storage_template_date_time_description')} {$t('admin.storage_template_date_time_sample', { values: { date: '2022-02-15T20:03:05.250+00:00' } })}{$t('admin.storage_template_date_time_sample', { values: { date: getExampleDate().toISO() } })}
-
- {$t('year')} -
    - {#each options.yearOptions as yearFormat, index (index)} -
  • {'{{'}{yearFormat}{'}}'} - {getLuxonExample(yearFormat)}
  • - {/each} -
-
- -
- {$t('month')} -
    - {#each options.monthOptions as monthFormat, index (index)} -
  • {'{{'}{monthFormat}{'}}'} - {getLuxonExample(monthFormat)}
  • - {/each} -
-
- -
- {$t('week')} -
    - {#each options.weekOptions as weekFormat, index (index)} -
  • {'{{'}{weekFormat}{'}}'} - {getLuxonExample(weekFormat)}
  • - {/each} -
-
- -
- {$t('day')} -
    - {#each options.dayOptions as dayFormat, index (index)} -
  • {'{{'}{dayFormat}{'}}'} - {getLuxonExample(dayFormat)}
  • - {/each} -
-
- -
- {$t('hour')} -
    - {#each options.hourOptions as dayFormat, index (index)} -
  • {'{{'}{dayFormat}{'}}'} - {getLuxonExample(dayFormat)}
  • - {/each} -
-
- -
- {$t('minute')} -
    - {#each options.minuteOptions as dayFormat, index (index)} -
  • {'{{'}{dayFormat}{'}}'} - {getLuxonExample(dayFormat)}
  • - {/each} -
-
- -
- {$t('second')} -
    - {#each options.secondOptions as dayFormat, index (index)} -
  • {'{{'}{dayFormat}{'}}'} - {getLuxonExample(dayFormat)}
  • - {/each} -
-
+ {@render example($t('year'), options.yearOptions)} + {@render example($t('month'), options.monthOptions)} + {@render example($t('week'), options.weekOptions)} + {@render example($t('day'), options.dayOptions)} + {@render example($t('hour'), options.hourOptions)} + {@render example($t('minute'), options.minuteOptions)} + {@render example($t('second'), options.secondOptions)}