alirezahematidev / jalaali-react-date-picker

This package is a date picker component for React that supports the Jalaali (Iranian/Shamsi/Persian) calendar system.
27 stars 5 forks source link

Selecting month automatically selects day #31

Open 1mehdifaraji opened 2 days ago

1mehdifaraji commented 2 days ago

Can't select day after selecting the month because it selects the day after clicking the month if the day is under the month label.

import { InputDatePicker } from "jalaali-react-date-picker";

 <InputDatePicker
          onChange={(e) => {
            console.log(e);
            if (e) setIsOpen(false);
          }}
          open={isOpen}
          renderInput={(params) => (
            <OutlinedTextField
              fullWidth
              label="تاریخ تولد"
              readOnly
              inputMode="none"
              onFocus={() => {
                setIsOpen(true);
              }}
              style={{ width: "100%" }}
            />
          )}

https://github.com/user-attachments/assets/5432c45d-4bdc-4c4b-812d-32c58a519acf

alirezahematidev commented 2 days ago

Thanks fot sharing your issues. To handle open/close the popover you must use onOpenChange property, onChange just listen the date changes For more info see the document: https://www.npmjs.com/package/jalaali-react-date-picker

On Fri, 27 Sept 2024, 02:11 Mehdi, @.***> wrote:

Can't select day after selecting the month because it selects the day after clicking the month if the day is under the month label.

import { InputDatePicker } from "jalaali-react-date-picker";

<InputDatePicker onChange={(e) => { console.log(e); if (e) setIsOpen(false); }} open={isOpen} renderInput={(params) => ( <OutlinedTextField fullWidth label="تاریخ تولد" readOnly inputMode="none" onFocus={() => { setIsOpen(true); }} style={{ width: "100%" }} /> )}

https://github.com/user-attachments/assets/5432c45d-4bdc-4c4b-812d-32c58a519acf

— Reply to this email directly, view it on GitHub https://github.com/alirezahematidev/jalaali-react-date-picker/issues/31, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZXI7RNT6UY6IJZ3A5PKRXLZYSESZAVCNFSM6AAAAABO57KX76VHI2DSMVQWIX3LMV43ASLTON2WKOZSGU2TCNRUHE2TCNI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

1mehdifaraji commented 2 days ago

@alirezahematidev The problem is when I select the month, If there is a day number behind the month element it will select the day also. It has nothing to with onChange or onOpenChange properties.

1mehdifaraji commented 2 days ago

https://github.com/user-attachments/assets/74fd65ce-6704-4060-a300-f8052a68d866

As you can see in the captured video of the behavior, selecting month will select the day under it's label. This is an unexpected behavior and I think it's an overflow issue.