ews-java-api icon indicating copy to clipboard operation
ews-java-api copied to clipboard

Possibly incorrect parsing of date/time values

Open lpld opened this issue 6 years ago • 0 comments

Hello.

I've been looking through the code of ews-java-api and realized that it doesn't always handle date/time values correctly.

Here is an article in EWS documentation that describes how clients should handle date/time values and timezones: https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/time-zones-and-ews-in-exchange

According to it, EWS servers can send date/time values in three different formats:

  • UTC with Z suffix: 2014-06-06T19:00:00.000Z
  • Specific timezone offset: 2014-06-06T19:00:00.000-08:00
  • No timezone: 2014-06-06T19:00:00.000

First two specify absolute values, so it's quite obvious how to parse them. But the latter is relative value and it cannot be converted to java.util.Date without additional timezone information. The article says that for Appointment.Start and Appointment.End values StartTimeZone and EndTimeZone should be used if present, but from the code I can see that ews-java-api uses UTC for such relative values, ignoring timezone properties of the Appointment.

I have never seen Exchange server sending date/time as relative values without timezone, but this case is described in documentation, so looks like it theory it can happen.

Has anyone seen this happen or faced this issue? Does ews-java-api ignore this case by design or is it a bug? Should we be worried when using it in production?

lpld avatar Dec 03 '19 10:12 lpld