Scheduler Daylight savings time support

7 posts, 0 answers
  1. Rem
    Rem avatar
    58 posts
    Member since:
    Dec 2006

    Posted 09 Oct 2007 Link to this post

    I realize that the scheduler control has a TimeZoneOffset property where I could enter the offset from UTC/GMT.  I was wondering if it had some property for DST support?

    When I create an event for a date that is before daylight savings, the time zone offset works fine:  Using monthly view, double clicking on a day before daylight savings went into effect shows the appointment startdate at 00:00 am for that date and the end date is 00:00 the next day - which is correct.  However, when I double click to create an appointment on a day after daylight savings has taken effect, the appointment start date becomes 01:00 for that date, and the end date is 01:00 for the next day, which is an hour extra (due to daylight savings).

    Is there a way to handle this or will we have to implement our own code?  Thanks
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2834 posts

    Posted 10 Oct 2007 Link to this post

    Hi Rem,

    Unfortunately, RadScheduler has no integrated support for DST. We have considered such support, but it is very complicated to implement. There are constant changes to the rules for the specific time zones and this information should be kept up-to-date. We are talking about 390 time zones here. We have decided that this is well outside the scope of RadScheduler and the developer should decide how to implement it. The chances are that he/she will only have to work with a limited number of time zones and the solution will not be that complex. The .NET framework itself provides basic information for the current time zone on the server.

    If you need detailed information about DST in different time zones you can use a time zone library. For example, the PublicDomain library at CodePlex offers up-to-date and complete information about time zones. With this information you can alter the appointments on-the-fly.

    Greetings,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. HEATHER EDWARDS
    HEATHER EDWARDS avatar
    1 posts
    Member since:
    Mar 2004

    Posted 10 Oct 2007 Link to this post

    Hi Rem,

    In the schedulers load method, I do this:

     protected void RadScheduler1_Load(object sender, EventArgs e)
        {
            // Set UTC offset
            TimeZone localZone = TimeZone.CurrentTimeZone;
            TimeSpan currentOffset =  localZone.GetUtcOffset(DateTime.Today);
            this.RadScheduler1.TimeZoneOffset = currentOffset;
        }

    Regards,
    Matthew Hall
    Halliburton
    Houston, Texas
  4. Rebecca Campbell
    Rebecca Campbell avatar
    8 posts
    Member since:
    Jul 2009

    Posted 28 Oct 2009 Link to this post

    I understand why you wouldn't want to maintain time zone information (we do it here and it's a real pain).  Have you considered adding a property that accepts a time zone rule?  Then maintenance of time zone rules still falls to the developers, but the controls can still handle the display properly.
  5. T. Tsonev
    Admin
    T. Tsonev avatar
    2834 posts

    Posted 02 Nov 2009 Link to this post

    Hi Rebecca,

    That's a very good suggestion. It'll provide this much needed functionality while still allowing us to focus on the core control development. We'll add it to our product backlog and we'll consider it for implementation in the next release.

    As a token of our gratitude for your involvement, your Telerik points have been updated.

    Sincerely yours,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Paul
    Paul avatar
    1 posts
    Member since:
    Mar 2013

    Posted 13 Mar 2013 Link to this post

    Hey Matthew,

    I tried your code and it works fine.

    TimeZone localZone = TimeZone.CurrentTimeZone;
            TimeSpan currentOffset =  localZone.GetUtcOffset(DateTime.Today);
            this.RadScheduler1.TimeZoneOffset = currentOffset;

    I changed "this.RadScheduler" to reference my control's ID and It worked.

    This was driving me crazy.  All "All Day" calendar events between Sunday of the start of Daylight Savings time and the end of the month (March) would not render correctly and when I would try to add new events it would create problems as well. It was also impossible for me (and my users to enter events on the first day (Sunday) of Daylight Savings Time.

    For anyone else reading this, there is a caveat. Your times in your database will now be offset by the difference between your time zone and GMT (4 hours for me since I am Eastern Standard Time).  This would mean that you would need to systematically correct all events entered prior to making this change.

    I still need to further testing before I decide to implement this.


    Many thanks.

    Paul
  7. Plamen
    Admin
    Plamen avatar
    3080 posts

    Posted 15 Mar 2013 Link to this post

    Hello Paul,

     
    You can also try using TimeZoneID property as shown in this on-line demo instead.

    Hope this will be helpful.

    Regards,
    Plamen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top