Unplanned
Last Updated: 05 Apr 2024 10:39 by ADMIN
Julian Turner
Created on: 19 Mar 2024 18:27
Category: DatePicker
Type: Feature Request
0
Add DateInput spinners to DatePicker
I use the DatePicker extensively in our application as people are entering in weather data. They often want to change the date by a day or two, so they find it annoying to open up the whole calendar to go back a single day. I think that the ideal UX would be to have the equivalent of the Spin Buttons on the DatePicker that exist on the DateInput. So, there would be the calendar for the date picker and the spinners so users can choose what works best for them.
5 comments
ADMIN
Wissam
Posted on: 05 Apr 2024 10:39

Hi, Julian,

Thank you for the example.

Basically, the spinners are taken as a part of the DateInput element that when clicked, opens the Popup. As a solution, you can handle the click event on the spinner buttons where you first need to give them the click event listener. In addition, you should stop the event propagation in order to not open the popup, and finally, increase or decrease the date value based on which button is clicked:

As the solution is very custom and additional code on the user's side, I will change the portal status of this feature request to add the Spinners to the DatePicker component from declined to unplanned. Having a spinners prop that automatically renders the spinner component that is handled in all scenarios is much more convenient.

Moreover, I updated your Telerik Points accordingly as a small token of gratitude for your suggestion.

If you have any questions, please let me know.

Regards,
Wissam
Progress Telerik

Are you interested in React Server Components? Have a look at our Kendo React Server Grid! https://www.telerik.com/kendo-react-ui/components/server-components/grid/
Julian Turner
Posted on: 29 Mar 2024 23:55

Hello, 

I was working on implementing the example you provided with the DateInput being passed into the DatePicker. I have run into an issue when the DatePicker's adaptive is set to true. Any time you click on a DateInput spinner to change the date, the calendar pops up. 

The following example demonstrates the issue, it is just what you had plus adaptive={true}

https://stackblitz.com/edit/react-ugado1-zgymnl?file=app%2Fmain.tsx

Is there a way to keep the calendar from popping up when the value is changed via the custom DateInput?

Thank you

ADMIN
Wissam
Posted on: 29 Mar 2024 15:35

Hello, Julian,

I will provide you with a solution on a new thread in order to keep the information consistent:

Regards,
Wissam
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Julian Turner
Posted on: 26 Mar 2024 15:41

Hi Wissam, 

Thanks for the example. It is what I was looking for. I had seen the documentation on customizing the DatePicker but hadn't thought of simply passing it a DateInput with the spinner enabled. An elegant solution.

Now my only problem is that my users expect the spinner to control the day by default instead of the month. I've submitted a feature request for that.
https://feedback.telerik.com/kendo-react-ui/1645610-have-dateinput-spinners-adapt-to-the-selected-date-part

Please let me know if you have another creative solution to handle that requirement using the existing controls as well. 

Thank you,

Julian

ADMIN
Wissam
Posted on: 26 Mar 2024 09:04

Hi, Julian,

Since this feature is available for the DateInput component, you can achieve this to the DatePicker by custom rendering its date input component. (The DatePicker uses the DateInput internally by default).

In the below example, I am setting the dateInput prop to `CustomDateInput` where I am returning the DateInput components with its spinners prop set to true:

For more information on customizing the DatePicker, check the following article:

I hope this helps, but please let me know if you have any further questions.

Regards,
Wissam
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!