kit
kit copied to clipboard
If 'bind:value' is set for 'input type=date', when entering the month/date with the keyboard, if the month/date starts with '0', the year portion of the input is removed.
Describe the bug
When bind:value is applied to input type=date and a date is entered with the keyboard, if the month/day starts with 0, the existing input is lost. Also reproduced in @sveltejs/kit 1.30.3 + svelte 4.2.8, @sveltejs/kit 2.0.0 + svelte 5.0.0-next.28
Reproduction
$ npm create svelte@latest my-app
┌ Welcome to SvelteKit!
│
◇ Which Svelte app template?
│ Skeleton project
│
◇ Add type checking with TypeScript?
│ Yes, using JavaScript with JSDoc comments
│
◇ Select additional options (use arrow keys/space bar)
│ none
│
└ Your project is ready!
$ cd my-app
$ npm install
$ npm run dev
// src/routes/+page.svelte
<script>
let date1 = "2024-01-01";
let date2 = "2024-01-02";
</script>
<p>date1: <input type="date" bind:value={date1} max="9999-12-31" /></p>
<p>date2: <input type="date" value={date2} max="9999-12-31" /></p>
https://github.com/sveltejs/kit/assets/1233318/89f455a5-15e9-4f32-8c6e-6793d750b400
Logs
No response
System Info
System:
OS: macOS 14.2.1
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 9.95 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.5.0 - /usr/local/bin/node
npm: 10.2.4 - /usr/local/bin/npm
bun: 1.0.4 - /usr/local/bin/bun
Browsers:
Microsoft Edge: 120.0.2210.91
npmPackages:
@sveltejs/adapter-auto: ^3.1.0 => 3.1.0
@sveltejs/kit: ^2.0.6 => 2.0.6
@sveltejs/vite-plugin-svelte: ^3.0.1 => 3.0.1
svelte: ^4.2.8 => 4.2.8
vite: ^5.0.10 => 5.0.10
Severity
annoyance
Additional Information
No response