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

Date Picker Auto Hide #1390

Open
2 tasks done
dlopesa opened this issue May 8, 2024 · 1 comment
Open
2 tasks done

Date Picker Auto Hide #1390

dlopesa opened this issue May 8, 2024 · 1 comment

Comments

@dlopesa
Copy link

dlopesa commented May 8, 2024

  • I have searched the Issues to see if this bug has already been reported
  • I have tested the latest version

Steps to reproduce

<Datepicker
            autoHide={true}
            onSelectedDateChanged={(date) => {
              const localDate = new Date(
                date.getTime() - date.getTimezoneOffset() * 60000
              );
              const dateString = localDate.toISOString().split("T")[0];
              console.log(dateString); // Log the date string
              setDate(dateString);
            }}
            className="dark"
          />

Current behavior

The auto hide does not work, even after selecting a date it does not disappear

Expected behavior

After choosing a day it should disappear

Context

Use a date picker

Video:
https://github.com/themesberg/flowbite-react/assets/39463084/b48cd144-9ad7-48c7-a9ac-495ad84225cf

@mmersiades
Copy link

I'm not sure if this will solve your problem, @dlopesa , but...

I had the same problem. I had the <DatePicker/> wrapped in a <label/>. Problem went away when I changed <label/> to <div/>.

FROM:

<label >
    <div >
        <span >
            {label}
          </span>
     </div>
     <Datepicker/>
</label>

TO:

<div >
    <div >
        <span >
            {label}
          </span>
     </div>
     <Datepicker/>
</div>

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

No branches or pull requests

2 participants