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

[Bug]: manually input end date for range in DatePicker make dateFormat wrong #13128

Closed
2 tasks done
Gong-la opened this issue Feb 10, 2023 · 2 comments · Fixed by #16202
Closed
2 tasks done

[Bug]: manually input end date for range in DatePicker make dateFormat wrong #13128

Gong-la opened this issue Feb 10, 2023 · 2 comments · Fixed by #16202

Comments

@Gong-la
Copy link

Gong-la commented Feb 10, 2023

Package

@carbon/react

Browser

Chrome

Package version

v1.22.0

React version

v17.0.2

Description

when set DatePicker's dateFormat="d/m/Y", the date format will wrong after change end date manually

Reproduction/example

https://stackblitz.com/edit/github-bcvgpb?file=src/App.jsx

Steps to reproduce

  1. Select start and end date (29/01/2023 and 09/02/2023)
  2. change the end date manually to 08/02/2023, onblur the input box
  3. the end date input value become 02/08/2023
  4. the start date input value become aN/aN/0NaN

Suggested Severity

Severity 1 = Must be fixed ASAP. The response must be swift. Someone from the team must drop all current work and be immediately reassigned to address the issue.

Application/PAL

No response

Code of Conduct

@cknabe
Copy link
Contributor

cknabe commented Mar 24, 2023

I cannot reproduce this on v1.25. But that might be because specifying a different date format, such as d/m/Y appears to be broken. I updated flatpickr to 4.6.13, but that didn't resolve it.

Maybe it is due to testing with the playground locally?

  1. Set the playground with the following:
  • allowInput: true
  • datePickerType: range
  • dateFormat: d/m/Y
  • placeholder: dd/mm/yyyy
  1. Input 05/02/23, tab to the 2nd input, and input 15/02/23
  2. After tabbing/pressing enter the first input in the range changes to 02/15/23 and the 2nd is empty.

The dates are displayed in m/d/Y. If I try to do the same thing outside of the Playground in Storybook, I see that it sets the 2nd date to 01/05/2001 and the first date is empty.

So clearly there are some issues going on here. I'm running out of time to debug them.
I never specifically set the locale, so maybe that's related?

@cknabe
Copy link
Contributor

cknabe commented Mar 24, 2023

"version": "1.25.0",
and
"flatpickr": "4.6.13",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants