Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/svelte-ux/src/lib/components/DateRangeField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
import Dialog from './Dialog.svelte';
import Field from './Field.svelte';

import { PeriodType, getDateFuncsByPeriodType, getPeriodTypeName } from '../utils/date';
import { PeriodType, getDateFuncsByPeriodType } from '../utils/date';
import { getDateRangePresets, type DateRange as DateRangeType } from '../utils/dateRange';
import { cls } from '../utils/styles';
import { getSettings } from './settings';

const dispatch = createEventDispatcher();
const settings = getSettings();
const { format } = settings;

const _defaultValue: DateRangeType = {
from: null,
Expand Down Expand Up @@ -60,7 +61,7 @@
</script>

<Field
label={label ?? (value.periodType ? getPeriodTypeName(settings, value.periodType) : '')}
label={label ?? (value.periodType ? $format.getPeriodTypeName(value.periodType) : '')}
{icon}
{error}
{hint}
Expand Down Expand Up @@ -153,7 +154,7 @@
>
<div class="flex flex-col justify-center bg-primary text-primary-content px-6 h-24">
<div class="text-sm opacity-50">
{currentValue.periodType ? getPeriodTypeName(settings, currentValue.periodType) : ''}&nbsp;
{currentValue.periodType ? $format.getPeriodTypeName(currentValue.periodType) : ''}&nbsp;
</div>
<div class="text-xl sm:text-2xl">
<DateRangeDisplay value={currentValue} />
Expand Down