Bug in Events Beta2?

Posted by Community Admin on 03-Aug-2018 17:28

Bug in Events Beta2?

All Replies

Posted by Community Admin on 12-Oct-2010 00:00

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  

Posted by Community Admin on 13-Oct-2010 00:00

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

Posted by Community Admin on 13-Oct-2010 00:00

Thank you, Hristo, that makes sense!

This thread is closed