I am trying to create a daily recurring event, using the Java edition of the Email API. Everything looks correct when Ioading the resulting .PST in Outlook except for the start & end dates - they both appear as one day prior to the input start & end dates.
Calendar jcalendar = Calendar.getInstance(java.util.TimeZone.getDefault()); jcalendar.set(2021, java.util.Calendar.MARCH, 1, 15, 30, 0) Date startDate = jcalendar.getTime() jcalendar.set(2021, java.util.Calendar.MARCH, 1, 16, 0, 0) Date endDate = jcalendar.getTime() MapiCalendar event = new MapiCalendar(location, summary, description, startDate, endDate) MapiCalendarDailyRecurrencePattern pattern = new MapiCalendarDailyRecurrencePattern() pattern.setPeriod(1) pattern.setStartDate(startDate) // recurrence.getUntil().getTime() is the input, returning: 5 March 2021, 15:30:00 UTC in millis pattern.setEndDate(new Date(recurrence.getUntil().getTime())) pattern.setEndType(MapiCalendarRecurrenceEndType.EndAfterDate) pattern.setPatternType(MapiCalendarRecurrencePatternType.Day) // pattern.setWeekStartDay(DayOfWeek.Monday) // NO EFFECT pattern.setDayOfWeek(DayOfWeek.Monday) // NO EFFECT MapiCalendarEventRecurrence r = new MapiCalendarEventRecurrence() r.setRecurrencePattern(pattern) r.setClipStart(startDate) r.setClipEndDate(pattern.getEndDate()) event.setRecurrence(r)
This results in an event that starts on February 28, 2021 at 15:30 and ends 30 minutes later, repeating each day through March 4, 2021. The number of occurrences is correct. But the start was supposed to be March 1 and the end should have been March 5.
Similarly, if I create another event beginning on a Thursday, it begins on Wednesday in Outlook. What do I need to change here?