File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
packages/svelte-ux/src/lib/components Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 13
13
const { format : format_ux } = getSettings ();
14
14
15
15
export let value: Date | null = null ;
16
- export let format = $format_ux . settings . formats . dates . baseParsing ?? ' MM/dd/yyyy ' ;
17
- export let mask = format . toLowerCase () ;
16
+ export let format: string | undefined = undefined ;
17
+ export let mask: string | undefined = undefined ;
18
18
export let replace = ' dmyh' ;
19
19
export let picker = false ;
20
20
21
+ $ : actualFormat = format ?? $format_ux .settings .formats .dates .baseParsing ?? ' MM/dd/yyyy' ;
22
+ $ : actualMask = mask ?? actualFormat .toLowerCase ();
23
+
21
24
// Field props
22
25
export let label = ' ' ;
23
26
export let error = ' ' ;
38
41
function onInputChange(e : any ) {
39
42
inputValue = e .detail .value ;
40
43
const lastValue = value ;
41
- const parsedValue = parseDate (inputValue ?? ' ' , format , new Date ());
44
+ const parsedValue = parseDate (inputValue ?? ' ' , actualFormat , new Date ());
42
45
value = isNaN (parsedValue .valueOf ()) ? null : parsedValue ;
43
46
if (value != lastValue ) {
44
47
dispatch (' change' , { value });
65
68
let:id
66
69
>
67
70
<Input
68
- value ={value ? $format_ux (value , PeriodType .Day , { custom: format }) : inputValue }
69
- { mask }
71
+ value ={value ? $format_ux (value , PeriodType .Day , { custom: actualFormat }) : inputValue }
72
+ mask ={ actualMask }
70
73
{replace }
71
74
{id }
72
75
on:change ={onInputChange }
You can’t perform that action at this time.
0 commit comments