This is a migrated thread and some comments may be shown as answers.

Undocumented use of kendo.timezones

3 Answers 649 Views
Globalization
This is a migrated thread and some comments may be shown as answers.
Jack
Top achievements
Rank 2
Iron
Jack asked on 20 Nov 2014, 09:50 PM
I could not find any documentation on the use of kendo.timezones:
  • http://docs.telerik.com/kendo-ui/framework/globalization/overview
  • http://docs.telerik.com/kendo-ui/framework/localization/overview

 

It seems to me that kendo has all the bricks to handle timezones without requiring momentJS or any other comparable library, but I cannot relally figure out how to use it.

Ideally, I want to store all dates server side in UTC format and display them in the user's timezone.

Question 1: Can Kendo UI detect user's timezone or should we let users define their timezone in the application profile?

Question 2: how do you convert from UTC to local timezone and from local timezone to UTC using the kendo framework?

Question 3: In a kendo.data.Model or kendo.observable, where do you recommend making conversions?

Question 4: In a kendo.data.DataSource, where do you recommend making conversions?

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 24 Nov 2014, 12:35 PM
Hello Jack,

Currently, methods part of the kendo.timezones namespace are not documented as they were developed for date modifications in Kendo UI Scheduler. Nevertheless, they are useful when it comes to timezone adjustments and we will document them in some of our next release of Kendo UI. For now please find my comments below:

#1: Kendo UI cannot detect user's time zone. In general, this is a hard process and will result just in "guessing" the user's time zone. This is the reason why the scheduduler needs a timezone option.

#2: We do have a convert method that converts Date object from one timezone to another:
var newDate = kendo.timezone.convert(date, "Europe/Sofia", "Etc/UTC");
//current date timezone - "Europe/Sofia"
//convert to "Etc/UTC" timezone
Here is a demo for a better understanding. Note that method just adjusts time portion of the object. JavaScript Date object always uses browser's timezone.

#3: One option is to convert the date in Set event of the Model.

#4: You can convert the dates before return the data in the schema.data callback.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Matt Johnson
Top achievements
Rank 1
answered on 23 Feb 2015, 02:19 AM
It would be helpful if we knew which version of the IANA time zone data was represented in the kendo.timezones.min.js file.  I just downloaded the latest release (Q3 2014) which appears to have come with data from version 2014h of the tzdb.  Perhaps the version number could be included in either the data or the comments of the file?

It would also be useful to be able to update this file myself - either by running some Telerik-provided utility against the IANA data, or by downloading updated versions from telerik directly.   Telerik releases quarterly, but IANA puts out tzdb updates much more frequently than that.   Depending on the app, it could be critical to apply a time zone update sooner than the next telerik release.

0
Georgi Krustev
Telerik team
answered on 25 Feb 2015, 07:38 AM
Hello Matt,

In general, we update the timezones information with each official release or if some major change has happened in between.

Currently, the timezone generator is not exposed and can be used only by a Telerik member. 

I will forward your request idea/request to allow the users to build the timezones information manually against the latest version of IANA library.

For now, if the timezone files are outdated for some reason, you can contact a Telerik member.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Globalization
Asked by
Jack
Top achievements
Rank 2
Iron
Answers by
Georgi Krustev
Telerik team
Matt Johnson
Top achievements
Rank 1
Share this question
or