Is your feature request related to a problem? Please describe.
date inputs are a bit awkward to deal with since their value is a YYYY-MM-DD string. There is a valueAsDate property which is more useful, but Svelte doesn't currently use that.
Describe the solution you'd like
bind:valueAsDate or bind:value, but coercing the value to a date (or rather, using valueAsDate being the scenes for bind:value on date inputs).
Using bind:value is arguably better — I'm not sure if there are many situations where the string is more useful. But it would be a breaking change.
On the other hand, number and range inputs already coerce values to numbers. So by using bind:valueAsDate but not differentiating between bind:value and bind:valueAsNumber on numeric inputs, we'd be introducing an inconsistency. Blah.
Not sure which is preferable.
How important is this feature to you?
It'd be a nice to have.
I am a Svelte newbie and I didn't even realize the date field wasn't coerced into a date.
Reading the tutorial I automatically assumed it would coerce all HTML fields correctly. My application mostly worked but started behaving strangely later in the flow. It took me a bit of time to realize it was the date string.
Not sure how valuable my input as a newbie is here but I would prefer the principle of least surprise, meaning bind:value would coerce what it can.
newbie here too, i would prefer if bind:valueAsDate and bind:valueAsNumber where used instead
I have worked with frontent for 10+ years and seen lib/frameworks come and go. Many reinvents the wheel and try to do form fields and validation in there own way - it's nothing but annoying to have to learn how to do something yet again.
think of it as this: if you where to port your application in a few years to/from svelte. the only thing two frameworks could have in common is if they used as much core functionality as possible
Would almost prefer bind:value to always be treated as a string also. When svelte treat numeric inputs value as number then it feels too magical and and somewhat unexpected. i might want to get something as a string sometimes
I think you got checkbox right, you bind the checked property instead of using bind:value
numeric inputs should not be treated any differently IMO.
Closing in favor of #3937.
Most helpful comment
newbie here too, i would prefer if
bind:valueAsDateandbind:valueAsNumberwhere used insteadI have worked with frontent for 10+ years and seen lib/frameworks come and go. Many reinvents the wheel and try to do form fields and validation in there own way - it's nothing but annoying to have to learn how to do something yet again.
think of it as this: if you where to port your application in a few years to/from svelte. the only thing two frameworks could have in common is if they used as much core functionality as possible
Would almost prefer
bind:valueto always be treated as a string also. When svelte treat numeric inputs value as number then it feels too magical and and somewhat unexpected. i might want to get something as a string sometimesI think you got checkbox right, you bind the
checkedproperty instead of usingbind:valuenumeric inputs should not be treated any differently IMO.