Set custom timezone for DatePicker/TimePicker

1 Answer 40 Views
DatePicker DateTimePicker TimePicker
Andrew
Top achievements
Rank 1
Andrew asked on 07 Jun 2024, 04:45 PM

hi, I'm using DatePicker & TimePicker components.  Seems like they use browser's time zone.

I need to customize time zone to one which is used on my backend.

Is there any way to do it?

1 Answer, 1 is accepted

Sort by
1
Wissam
Telerik team
answered on 11 Jun 2024, 08:39 AM

Hello, Andrew,

We provide the option to set your own date value by handling the component in controlled mode. This is done using the onChange event and value prop:

As we pass Javascript dates, you can refer to the following StackOverFlow article or a similar one for initializing the date based on the timezone:

We have an example for the DateTimePicker where the UTC date value is displayed by directly converting the time using the setHours method based on the difference between GMT and UTC. You use this approach based on the timezone you are receiving from the backend:

On the other hand, we have a feature request for adding a timezone prop for the DateTimePicker component. I changed the FR to have it for all components in the dateinputs package, and added a vote on your behalf in order to increase its priority:

If you have any further questions on this matter, please let me know.

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!

Tags
DatePicker DateTimePicker TimePicker
Asked by
Andrew
Top achievements
Rank 1
Answers by
Wissam
Telerik team
Share this question
or