ronnieholm / SPCalendarRecurrenceExpander

Turns each SharePoint calendar recurrence event into a series of individual events, taking into account recurrence exceptions
BSD 2-Clause "Simplified" License
14 stars 5 forks source link

The string was not recognized as a valid DateTime. #9

Closed GGillert closed 8 years ago

GGillert commented 8 years ago

Dear Ronnieholm, we test your project with the example code against a sharepoint online calendar. We have german local settings. on the code row " var recurrenceInstances = expander.Expand(collapsedAppointments);" we get a FormatException; this string was not recognized as a valid DateTime. In debug mode we found our problem. with german local settings sharepoint use the date time format dd.mm.yyyy you use mm/dd/yyyy so we get a problem with all days greater then 12.

So you have a new improvement proposal: Please regard local date formats in your next Version

ronnieholm commented 8 years ago

Thank you for taking the time to report an issue.

I've been using the expander with Danish for the past few years and haven't run into such issue before. The Danish date format is like German except the separater is a dash instead of a dot.

I followed these steps to try to reproduce:

  1. In SharePoint Online, create a new Team Site collection based on German language
  2. Create a TestCalendar with the German site collection
  3. Create a daily recurrence appointment starting May 23, 2016 and repeat for five instances

Here's SharePoint's internal data structure for the recurrence appointment. Notice how SharePoint doesn't use the local date format:

[[("ID", Some 1); ("EventDate", Some 5/23/2016 12:00:00 PM);
  ("EndDate", Some 5/27/2016 1:00:00 PM); ("Duration", Some 3600);
  ("fRecurrence", Some true); ("EventType", Some 1);
  ("MasterSeriesItemID", Some null); ("RecurrenceID", Some null);
  ("RecurrenceData",
   Some
     "<recurrence><rule><firstDayOfWeek>mo</firstDayOfWeek><repeat><daily dayFre
       quency="1" /></repeat><repeatInstances>5</repeatInstances></rule></recurrence>");
  ("fAllDayEvent", Some false)]]

The above expands to:

1 A01 5/23/2016 5:00 AM 5/23/2016 6:00 AM 1 A01 5/24/2016 5:00 AM 5/24/2016 6:00 AM 1 A01 5/25/2016 5:00 AM 5/25/2016 6:00 AM 1 A01 5/26/2016 5:00 AM 5/26/2016 6:00 AM 1 A01 5/27/2016 5:00 AM 5/27/2016 6:00 AM

Could you provide a stack trace and more detailed reproduction steps?

ronnieholm commented 8 years ago

Closing due to lack of reproducibility.