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

Cannot select time when selectsRange prop is true #4649

Open
yubinjodev opened this issue Mar 29, 2024 · 0 comments
Open

Cannot select time when selectsRange prop is true #4649

yubinjodev opened this issue Mar 29, 2024 · 0 comments

Comments

@yubinjodev
Copy link

Describe the bug
When selectsRange is true, selecting the date along with time causes a type error. Just selecting the dates does not.

To Reproduce
Steps to reproduce the behavior:

  const [startDate, setStartDate] = useState<Date | null>(null)
  const [endDate, setEndDate] = useState<Date | null>(null)

  const handleChange = ([newStartDate, newEndDate]:[Date, Date]) => {
    setStartDate(newStartDate);
    setEndDate(newEndDate);
  };

  return (
    <DatePicker
        selected={startDate}
        onChange={handleChange}
        selectsRange
        startDate={startDate}
        endDate={endDate}
        dateFormat="yyyy-MM-dd HH:mm:ss"
        timeFormat="HH:mm:ss"
        showTimeSelect
    />
  );

  1. Select date
  2. Select time

Expected behavior
I expected that I could select a range that includes both date and time

Screenshots
image

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome
  • Version: 123.0.6312.87

Smartphone (please complete the following information):
None

Additional context
None

@yubinjodev yubinjodev changed the title cannot select time when selectsRange is true Cannot select time when selectsRange prop is true Mar 29, 2024
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

1 participant