Skip to content

Calendar minValue={nextYear} breaks yearSelect #1873

Description

@zomchak-code

Describe the bug

If you set Calendar minValue to next year - then initial state will display empty year select value.
More importantly, it will cause yearSelectState.snippetProps.selectedYearItem to be undefined while it's typed as { value: number; label: string; }
This leads to bugs when using the library, for example https://shadcn-svelte.com/docs/components/calendar will completely break if you use captionLayout="dropdown" with minValue={parseDate('2026-01-01'}

Reproduction

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

Logs

System Info

System:
    OS: macOS 15.6.1
    CPU: (10) arm64 Apple M4
    Memory: 92.42 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.17.1 - /Users/mcbuk/.nvm/versions/node/v22.17.1/bin/node
    npm: 10.9.2 - /Users/mcbuk/.nvm/versions/node/v22.17.1/bin/npm
    pnpm: 10.17.1 - /Users/mcbuk/.nvm/versions/node/v22.17.1/bin/pnpm
    bun: 1.3.1 - /Users/mcbuk/.bun/bin/bun
  Browsers:
    Brave Browser: 141.1.83.118
    Safari: 18.6
  npmPackages:
    svelte: catalog: => 5.38.1

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageA maintainer needs to review this issue and label it appropriately

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions