Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatePicker: Getting NaN.NaN.NaN when using with Form validation and dateFormat set #7120

Closed
2 of 4 tasks
mana-ma opened this issue Jan 20, 2025 · 2 comments
Closed
2 of 4 tasks
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@mana-ma
Copy link

mana-ma commented Jan 20, 2025

Describe the bug

When using the DatePicker with the form validation and setting the dateFormat on the Datepicker to dateFormat="dd.mm.yy" you get a NaN.NaN.NaN prefill.

Anyone got a fix?

Pull Request Link

No response

Reason for not contributing a PR

  • Lack of time
  • Unsure how to implement the fix/feature
  • Difficulty understanding the codebase
  • Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/4bhyxsr3?file=src%2FApp.vue

Environment

Stackblitz?

Vue version

4.x.x

PrimeVue version

4.x.x

Node version

No response

Browser(s)

No response

Steps to reproduce the behavior

  1. Fork DatePicker Form Example in docs
  2. Add dateFormat="dd.mm.yy" to Datepicker

Expected behavior

Placeholder value gets displayed

@mana-ma mana-ma added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 20, 2025
@J-Michalek
Copy link
Contributor

@mana-ma Hello, the DatePicker component does not accept a string as its value - changing the initial value to Date, undefined or null should resolve your issue.

The complete type for the value is: Date | Array<Date> | Array<Date | null> | undefined | null

@mana-ma
Copy link
Author

mana-ma commented Jan 21, 2025

@J-Michalek thank you. It worked with setting the initial value to null.

@mana-ma mana-ma closed this as completed Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

2 participants