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]: DatePicker with type range renders value property incorrectly #16848

Closed
2 tasks done
KJaspers opened this issue Jun 24, 2024 · 3 comments
Closed
2 tasks done

[Bug]: DatePicker with type range renders value property incorrectly #16848

KJaspers opened this issue Jun 24, 2024 · 3 comments
Labels

Comments

@KJaspers
Copy link

KJaspers commented Jun 24, 2024

Package

@carbon/react

Browser

No response

Package version

v1.60.1

React version

v18.3.1

Description

I use a DatePicker in our product very similar to this:

 const [start, setStart] = useState();
 const [end, setEnd] = useState();

 const onPeriodChanged = (range) => {
   setStart(range[0]);
   setEnd(range[1]);
 };

 return (
   <div>
     <DatePicker
       datePickerType="range"
       value={[start, end]}
       onChange={onPeriodChanged}
     >
       <DatePickerInput
         id="date-picker-input-id-start"
         placeholder="mm/dd/yyyy"
         labelText="Start date"
         size="md"
       />
       <DatePickerInput
         id="date-picker-input-id-finish"
         placeholder="mm/dd/yyyy"
         labelText="End date"
         size="md"
       />
     </DatePicker>
   </div>
 );

When selecting a range, the first input contains start & end date. This shouldn't be, right?

Screenshot 2024-06-24 at 08 37 06

Note: With previous versions (Carbon 10) this worked...

Reproduction/example

https://stackblitz.com/edit/github-7ujtwx?file=src%2FApp.jsx

Steps to reproduce

  • Select a date range
  • Expected: The first input shows the start date only
  • Actual: The first input contains start & date

Screenshot 2024-06-24 at 08 37 06

Note: With previous versions (Carbon 10) this worked...

Suggested Severity

None

Application/PAL

No response

Code of Conduct

@KJaspers KJaspers changed the title [Bug]: DatepPicker with type range renders value property incorrectly [Bug]: DatePicker with type range renders value property incorrectly Jun 24, 2024
@bendiggle
Copy link

I have also been seeing the same and left a comment on a previous closed issue
Screenshot 2024-06-14 at 08 59 27

@riddhybansal
Copy link
Contributor

riddhybansal commented Jun 25, 2024

Hey @KJaspers @bendiggle We already have any raised issue for this and added in our sprint.

@sstrubberg
Copy link
Member

Dupe #16734

@sstrubberg sstrubberg closed this as not planned Won't fix, can't repro, duplicate, stale Jul 2, 2024
@github-project-automation github-project-automation bot moved this from ⏱ Backlog to ✅ Done in Design System Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

4 participants