Skip to content

Commit 4156feb

Browse files
committed
Adding test for direct number binding.
1 parent 49c3b1e commit 4156feb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/routes/tests/datetime-local/+page.svelte

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import {
33
dateProxy,
44
intProxy,
5+
numberProxy,
56
superForm,
67
superValidateSync
78
} from '$lib/client';
@@ -30,7 +31,7 @@
3031
empty: 'undefined'
3132
});
3233
33-
const num = intProxy(form, 'number', {
34+
const num = numberProxy(form, 'number', {
3435
empty: 'undefined'
3536
});
3637
</script>
@@ -46,6 +47,14 @@
4647
Name: <input name="date" type="datetime-local" bind:value={$date} />
4748
{#if $errors.date}<span class="invalid">{$errors.date}</span>{/if}
4849
</label>
50+
<label>
51+
Number2: <input
52+
name="number2"
53+
type="number"
54+
bind:value={$form.number2}
55+
/>
56+
{#if $errors.number2}<span class="invalid">{$errors.number2}</span>{/if}
57+
</label>
4958
<div>
5059
<button>Submit</button>
5160
</div>

src/routes/tests/datetime-local/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { z } from 'zod';
22

33
export const schema = z.object({
44
number: z.number().optional(),
5+
number2: z.number().optional(),
56
date: z
67
.date()
78
.min(new Date('2021-01-01'))

0 commit comments

Comments
 (0)