-
| I have my own // DateField.svelte <script lang="ts"> import { DateField } from 'bits-ui' import type { DateValue } from '@internationalized/date' let { label = 'Select a date', value = $bindable(), placeholder = $bindable(), name, // exists here invalid = $bindable(false), error = $bindable(), ...restProps }: DateField.RootProps & { label: string name?: string invalid?: boolean error?: string } = $props() </script> <DateField.Root bind:value bind:placeholder {...restProps} > <div> <DateField.Label>{label}</DateField.Label> <DateField.Input {name}> <!-- passed correctly to Input --> {#snippet children({ segments })} {#each segments as { part, value }, i (part + i)} <div> {#if part === 'literal'} <DateField.Segment {part} > {value} </DateField.Segment> {:else} <DateField.Segment {part} > {value} </DateField.Segment> {/if} </div> {/each} {/snippet} </DateField.Input> </div> </DateField.Root>In usage (paired with SuperForms) to get the ISO value I'm passing a <script lang="ts"> import { getLocalTimeZone, ZonedDateTime, now } from '@internationalized/date' let dateValue = $state<ZonedDateTime | undefined>(now(getLocalTimeZone())) $effect(() => { if (dateValue) { $scheduleForm.nextTime = dateValue.toAbsoluteString() } }) </script> <DateField name="nextTime" label={`Next time (${getLocalTimeZone()})`} minValue={today(getLocalTimeZone())} granularity="minute" bind:value={dateValue} />However, the hidden input while appears (as per docs), its Am I doing something wrong in my setup? |
Beta Was this translation helpful? Give feedback.
Answered by huntabyte Jun 18, 2025
Replies: 1 comment 1 reply
-
| Check this: https://svelte.dev/playground/e96d77a211ad4427ae59e12b890e0317?version=latest If you try to pull the value from the input via formdata/form submission or another way, you should have a value, for some reason Svelte doesn't show it in the DOM when it's reactive. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by igorlanko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment


Check this: https://svelte.dev/playground/e96d77a211ad4427ae59e12b890e0317?version=latest
If you try to pull the value from the input via formdata/form submission or another way, you should have a value, for some reason Svelte doesn't show it in the DOM when it's reactive.