New to Kendo UI for Angular? Start a free 30-day trial

Managing Time Zones with the DateInputs Components

Environment

ProductProgress® Kendo UI® for Angular DateInputs

Description

When I select a date in one of the Kendo UI for Angular DateInputs components, the date is displayed in UTC with the local machine's time zone offset. How can I manage the time zone offset?

Solution

The Kendo UI for Angular DateInputs components require a valid JavaScript Date instance as their value. These components use the UTC format to represent the date and time, along with the time zone of the user's browser. As a result, the applied time offset will vary based on the user's location and time zone.

This behavior is in accordance with the default settings of JavaScript Date object. For more in-depth details, see the following GitHib issue.

To remove the time zone information from a Date object, use the toISOString() method. This will return the date in a format that does not include any time zone information. This conversion can be done when the valueChange event is triggered for the respected DateInputs component.

The following example demonstrates how to the usage use the toISOString() method:

Example
View Source
Change Theme:

In this article

Not finding the help you need?