More in this section

Forums / General Discussions / Bug in Events Beta2?

Bug in Events Beta2?

3 posts, 1 answered
  1. Ann
    Ann avatar
    16 posts
    Registered:
    25 Aug 2010
    12 Oct 2010
    Link to this post
    I am experiencing some sort of bug in the Events module and was wondering if you were aware of this or not.

    I create or edit an event in the Events UI.  I enter an event start time and end time and click "Save changes."  When I view the event again via the Events UI, the time is shown as the exact time that I entered before.  However, when I view the event on my website, which is using the API to access the start and end time, the time is displayed as being five (5) hours ahead of the time I specified when creating or editing the event in the UI. 

    I am assuming this has to do with timezones.  Is there anywhere I can set the timezone on events?  I am in EST in the US so it looks like the event is displaying in GMT. 

    Thank you,
    Ann  
  2. Hristo Borisov
    Hristo Borisov avatar
    190 posts
    Registered:
    19 Jun 2017
    13 Oct 2010
    Link to this post
    Hello Ann,

    Thank you for contacting us.

    All datetime objects are stored in database as GMT. In the UI we are converting all dates to local time, however since you are working directly with the objects stored in the database there is no conversion applied to them. That is why, when working with the API and you want to create a custom functionality to display the events or any other object that is of type DateTime, you have to convert them to local time. Sitefinity is using the following code to convert the datetime to local based on the user's time zone.

    public DateTime ToLocal(DateTime value)
    {
        var timeZoneInfo = UserManager.GetManager().GetUserTimeZone();
        return TimeZoneInfo.ConvertTime(value, timeZoneInfo);
    }

    I hope this will resolve your issue, let me know if you have any other questions.

    Greetings,
    Hristo Borisov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Ann
    Ann avatar
    16 posts
    Registered:
    25 Aug 2010
    13 Oct 2010
    Link to this post
    Thank you, Hristo, that makes sense!
3 posts, 1 answered