How to Automatically Open Time Picker After Date is Selected in DateTimePickerComponent?

Hi Syncfusion team,
I'm using the DateTimePickerComponent in a React application and would like to improve the user experience by automatically opening the time selection popup immediately after a user selects a date.Currently, two actions (clicks) are required to select date and time. Do you have any examples on how to achieve it?


2 Replies

YS Yohapuja Selvakumaran Syncfusion Team April 10, 2025 01:09 PM UTC

Hi Jake Balders,

Thank you for reaching out to us.


We have reviewed your requirement and would like to confirm that it is possible to automatically open the time picker popup after selecting a value from the date picker popup in the DateTimePickerComponent.


To achieve this, you can use the change event of the component and invoke the show('time') method after a short delay. This ensures that the time popup opens after the date popup has closed.


Please refer to the sample code below for your reference:


 

const Default = () => {

  const dateTimeRef = useRef(null);

 

  const handleChange = () => {

    setTimeout(() => {

      dateTimeRef.current.show('time');

    }, 150); // Wait for calendar popup to close

  };

 

  return (

    <div className="control-pane">

      <div className="control-section">

        <div className="datetimepicker-control-section">

          <DateTimePickerComponent ref={dateTimeRef} change={handleChange} />

        </div>

      </div>

    </div>

  );

};

 

 

 

 


You can also check out this live sample for more details:


Sample: https://stackblitz.com/edit/react-6wvh7nip-pvqkhd2q?file=index.js



Regards,

Yohapuja S




JB Jake Balders April 10, 2025 06:22 PM UTC

Thank you for providing this solution. It's almost perfect except for one small but important thing. 

In your sample here:
https://stackblitz.com/edit/react-6wvh7nip-pvqkhd2q?file=index.js
you can see that after selecting a time, the popup remains open, which might be a bit confusing for users—they need to either click the input again or click outside to close it.

Is there a way to automatically close the time picker pop-up after a time is selected?


Loader.
Up arrow icon