Skip to content

Date Field: Cannot read properties of undefined (reading 'toDate') #1736

@x0k

Description

@x0k

Describe the bug

This code causes an error in the console.

<script lang="ts">
    import { DateField } from "bits-ui";

    let attributes = $state({
        disabled: false,
    })
    $effect(() => {
        attributes = { disabled: false }
    })
</script>

<DateField.Root {...attributes}>

Reproduction

https://stackblitz.com/edit/ftizdzhu?file=src%2Froutes%2F%2Bpage.svelte

Logs

System Info

System:
    OS: Linux 6.12 cpe:/o:nixos:nixos:25.05 25.05 (Warbler)
    CPU: (12) x64 Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz
    Memory: 7.37 GB / 15.56 GB
    Container: Yes
    Shell: 5.2.37 - /run/current-system/sw/bin/bash
  Binaries:
    Node: 24.6.0 - /nix/store/dr4iqh2lnz5sna2xqa1a2qk9aq9r6lh7-nodejs-24.6.0/bin/node
    npm: 11.5.1 - /nix/store/dr4iqh2lnz5sna2xqa1a2qk9aq9r6lh7-nodejs-24.6.0/bin/npm
    pnpm: 10.15.0 - /nix/store/65rkaln4s38pi0f8ljll439alcs875jm-pnpm-10.15.0/bin/pnpm
  Browsers:
    Brave Browser: 139.1.81.131
  npmPackages:
    @sveltejs/kit: ^2.22.0 => 2.37.0 
    bits-ui: ^2.9.4 => 2.9.4 
    svelte: ^5.0.0 => 5.38.6

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    under reviewBeing reviewed to determine whether it is an issue with Bits UI, a dependency, or user error.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions