@@ -358,6 +358,31 @@ mivExchangeEvent.prototype = {
358358 }
359359
360360
361+ // IsAllDayEvent must be inserted before Start/End, as updating the latter won't work if the event was all day previously
362+ // See also: https://github.com/ExchangeCalendar/exchangecalendar/issues/286
363+ if ( this . _newStartDate ) {
364+ this . _nonPersonalDataChanged = true ;
365+ if ( this . _newStartDate . isDate ) {
366+ this . addSetItemField ( updates , "IsAllDayEvent" , "true" ) ;
367+ }
368+ else {
369+ this . addSetItemField ( updates , "IsAllDayEvent" , "false" ) ;
370+ }
371+
372+ }
373+ else {
374+ if ( this . _newEndDate ) {
375+ this . _nonPersonalDataChanged = true ;
376+ if ( this . _newEndDate . isDate ) {
377+ this . addSetItemField ( updates , "IsAllDayEvent" , "true" ) ;
378+ }
379+ else {
380+ this . addSetItemField ( updates , "IsAllDayEvent" , "false" ) ;
381+ }
382+
383+ }
384+ }
385+
361386 if ( this . _newStartDate ) {
362387 var tmpStart = this . _newStartDate . clone ( ) ;
363388 if ( this . _newStartDate . isDate ) {
@@ -443,29 +468,6 @@ mivExchangeEvent.prototype = {
443468 }
444469 }
445470
446- if ( this . _newStartDate ) {
447- this . _nonPersonalDataChanged = true ;
448- if ( this . _newStartDate . isDate ) {
449- this . addSetItemField ( updates , "IsAllDayEvent" , "true" ) ;
450- }
451- else {
452- this . addSetItemField ( updates , "IsAllDayEvent" , "false" ) ;
453- }
454-
455- }
456- else {
457- if ( this . _newEndDate ) {
458- this . _nonPersonalDataChanged = true ;
459- if ( this . _newEndDate . isDate ) {
460- this . addSetItemField ( updates , "IsAllDayEvent" , "true" ) ;
461- }
462- else {
463- this . addSetItemField ( updates , "IsAllDayEvent" , "false" ) ;
464- }
465-
466- }
467- }
468-
469471 if ( ( ( this . _newStartDate ) || ( this . _newEndDate ) ) && ( this . calendar . isVersion2007 ) ) {
470472 if ( this . _newStartDate ) {
471473 this . addSetItemField ( updates , "MeetingTimeZone" , null , {
0 commit comments