2022-12-16 14:26:12 -06:00
|
|
|
<script lang="ts">
|
2024-02-22 15:36:14 +01:00
|
|
|
import { locale } from '$lib/stores/preferences.store';
|
2024-02-14 08:09:49 -05:00
|
|
|
import type { SystemConfigTemplateStorageOptionDto } from '@immich/sdk';
|
2026-01-21 10:41:09 -06:00
|
|
|
import { Card, CardBody, CardHeader, Text } from '@immich/ui';
|
2024-02-22 15:36:14 +01:00
|
|
|
import { DateTime } from 'luxon';
|
2024-06-04 21:53:00 +02:00
|
|
|
import { t } from 'svelte-i18n';
|
2022-12-16 14:26:12 -06:00
|
|
|
|
2024-11-14 08:43:25 -06:00
|
|
|
interface Props {
|
|
|
|
|
options: SystemConfigTemplateStorageOptionDto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let { options }: Props = $props();
|
2022-12-16 14:26:12 -06:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
const getLuxonExample = (format: string) => {
|
2025-10-27 07:21:37 -07:00
|
|
|
return DateTime.fromISO('2022-02-15T20:03:05.250Z', { locale: $locale }).toFormat(format);
|
2023-07-01 00:50:47 -04:00
|
|
|
};
|
2022-12-16 14:26:12 -06:00
|
|
|
</script>
|
|
|
|
|
|
2026-01-21 10:41:09 -06:00
|
|
|
<Text size="small">{$t('date_and_time')}</Text>
|
2022-12-16 14:26:12 -06:00
|
|
|
|
2025-03-03 14:24:26 +00:00
|
|
|
<!-- eslint-disable svelte/no-useless-mustaches -->
|
2026-01-21 10:41:09 -06:00
|
|
|
<Card class="mt-2 text-sm bg-light-50 shadow-none">
|
|
|
|
|
<CardHeader>
|
|
|
|
|
<Text class="mb-1">{$t('admin.storage_template_date_time_description')}</Text>
|
|
|
|
|
<Text color="primary"
|
2026-02-23 05:34:56 -05:00
|
|
|
>{$t('admin.storage_template_date_time_sample', { values: { date: '2022-02-15T20:03:05.250+00:00' } })}</Text
|
2026-01-21 10:41:09 -06:00
|
|
|
>
|
|
|
|
|
</CardHeader>
|
|
|
|
|
<CardBody>
|
|
|
|
|
<div class="grid grid-cols-1 gap-6 sm:grid-cols-3 md:grid-cols-4">
|
|
|
|
|
<div>
|
|
|
|
|
<Text fontWeight="medium" size="tiny" color="primary" class="mb-1">{$t('year')}</Text>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each options.yearOptions as yearFormat, index (index)}
|
|
|
|
|
<li>{'{{'}{yearFormat}{'}}'} - {getLuxonExample(yearFormat)}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2022-12-16 14:26:12 -06:00
|
|
|
|
2026-01-21 10:41:09 -06:00
|
|
|
<div>
|
|
|
|
|
<Text fontWeight="medium" size="tiny" color="primary" class="mb-1">{$t('month')}</Text>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each options.monthOptions as monthFormat, index (index)}
|
|
|
|
|
<li>{'{{'}{monthFormat}{'}}'} - {getLuxonExample(monthFormat)}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2022-12-16 14:26:12 -06:00
|
|
|
|
2026-01-21 10:41:09 -06:00
|
|
|
<div>
|
|
|
|
|
<Text fontWeight="medium" size="tiny" color="primary" class="mb-1">{$t('week')}</Text>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each options.weekOptions as weekFormat, index (index)}
|
|
|
|
|
<li>{'{{'}{weekFormat}{'}}'} - {getLuxonExample(weekFormat)}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2023-09-28 19:47:31 +02:00
|
|
|
|
2026-01-21 10:41:09 -06:00
|
|
|
<div>
|
|
|
|
|
<Text fontWeight="medium" size="tiny" color="primary" class="mb-1">{$t('day')}</Text>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each options.dayOptions as dayFormat, index (index)}
|
|
|
|
|
<li>{'{{'}{dayFormat}{'}}'} - {getLuxonExample(dayFormat)}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2022-12-16 14:26:12 -06:00
|
|
|
|
2026-01-21 10:41:09 -06:00
|
|
|
<div>
|
|
|
|
|
<Text fontWeight="medium" size="tiny" color="primary" class="mb-1">{$t('hour')}</Text>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each options.hourOptions as dayFormat, index (index)}
|
|
|
|
|
<li>{'{{'}{dayFormat}{'}}'} - {getLuxonExample(dayFormat)}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2022-12-16 14:26:12 -06:00
|
|
|
|
2026-01-21 10:41:09 -06:00
|
|
|
<div>
|
|
|
|
|
<Text fontWeight="medium" size="tiny" color="primary" class="mb-1">{$t('minute')}</Text>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each options.minuteOptions as dayFormat, index (index)}
|
|
|
|
|
<li>{'{{'}{dayFormat}{'}}'} - {getLuxonExample(dayFormat)}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2022-12-16 14:26:12 -06:00
|
|
|
|
2026-01-21 10:41:09 -06:00
|
|
|
<div>
|
|
|
|
|
<Text fontWeight="medium" size="tiny" color="primary" class="mb-1">{$t('second')}</Text>
|
|
|
|
|
<ul>
|
|
|
|
|
{#each options.secondOptions as dayFormat, index (index)}
|
|
|
|
|
<li>{'{{'}{dayFormat}{'}}'} - {getLuxonExample(dayFormat)}</li>
|
|
|
|
|
{/each}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2023-07-01 00:50:47 -04:00
|
|
|
</div>
|
2026-01-21 10:41:09 -06:00
|
|
|
</CardBody>
|
|
|
|
|
</Card>
|