Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
<script>
const attributes1 = {min: '2021-09-21'};
const attributes2 = {required: true};
let value1 = '2021-09-21';
let value2 = '2021-09-21';
let value3 = '2021-09-21';
//I expected the first two inputs to behave the same, but the second one gets weird when typing in the date instead of choosing (click on the 21, and try to type 21 - types 02 and 01, reseting input after typing). Works only if the first input would be the same as the second one (ie going from 02 to 21 works, but from 02 - the thing that pops in when typing 21 - it does't work. It is needed to type 221 to get 21.)
//the most interesting is that it works fine if the min attribute is set the htmlish way or if a different attribute is set in the svelte way. Also, I think it was introduced in 3.24.0 when solving #4418, as it works in 3.23.2
</script>

<div>
Working input:
<input type=date min={attributes1.min} bind:value={value1}/>
</div>

<div>
Broken input:
<input type=date {...attributes1} bind:value={value2}/>
</div>

<div>
Working input:
<input type=date {...attributes2} bind:value={value3}/>
</div>

loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */