Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025

 


Article

Multiple non-recurrent all-day events are shifted with one day backwards after upgrade

« Go Back

Information

 
Article Number000071817
EnvironmentProduct: Sitefinity
Version: 9
OS: All supported OS versions
Database: Microsoft SQL Server 2012 SP2
Question/Problem Description
Due to changes in Events calculation, multiple non-recurrent all-day events will shift with one day backwards (earlier) to its originally entered value after upgrade to Sitefinity 9.0.
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
All-day events are not properly displayed using the Events widget Calendar view.
Resolution

Instead of republishing each event manually, use the code bellow to update multiple non-recurrent all-day events automatically using API:

protected void AddOneDayToMultpleAllDayEvent(object sender, EventArgs eventArgs)
{
      var providers = EventsManager.ProvidersCollection;
      if (providers == null)
          providers = EventsManager.GetManager().Providers;
     foreach (var provider in providers)
     {
         var manager = EventsManager.GetManager(provider.Name);
         using (new ElevatedModeRegion(manager))
         {
            var allDayEvents = manager.GetEvents().Where(e => e.AllDayEvent);
            foreach (Event @event in allDayEvents)
            {
               if (!@event.IsRecurrent)
               {
                  var timeSpan = @event.EventEnd.Value - @event.EventStart;
                  if (timeSpan.TotalDays > 1)
                  {
                      @event.EventEnd = @event.EventEnd.Value.AddHours(24);
                  }
                }
             }
             manager.SaveChanges();
         }
     }
}
Workaround
Notes
Attachment 
Last Modified Date7/18/2016 8:39 PM