shadcn-vue
shadcn-vue copied to clipboard
[Bug]: Auto Form toDate is not a function when form schema has default value
Reproduction
https://stackblitz.com/edit/nuxt-vue-3-4-beta-twkyrr?file=src%2Fpages%2Fhome%2FHomePage.vue
Describe the bug
In documentation:
If you want to set default value of date, convert it to Date first using new Date(val).
An error occurs during
{{ slotProps.componentField.modelValue ? df.format(slotProps.componentField.modelValue.toDate(getLocalTimeZone())) : "Pick a date" }}
because slotProps.componentField.modelValue is of type string and not a DateValue like expected by Calendar component.
System Info
System:
OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-1235U
Memory: 2.89 GB / 15.30 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
pnpm: 9.10.0 - ~/.local/share/pnpm/pnpm
bun: 1.1.27 - ~/.bun/bin/bun
Browsers:
Chrome: 129.0.6668.58
Contributes
- [ ] I am willing to submit a PR to fix this issue
- [ ] I am willing to submit a PR with failing tests