ebeigarts / exchanger

Ruby client for Exchange Web Services
MIT License
57 stars 36 forks source link

Incorrect UTC support #11

Open pcboy opened 11 years ago

pcboy commented 11 years ago

When I'm using the CalendarItem, EWS is returning CalendarEvents like this:

          <CalendarEvent>
            <StartTime>2013-08-26T06:43:53</StartTime>
            <EndTime>2013-08-26T06:53:53</EndTime>
            <BusyType>Busy</BusyType>
          </CalendarEvent>

The exchanger library is calling Time.xmlschema on these times. The problem is that they are not in the correct xmlschema format. These times are UTC. But the xmlschema specification is clear, for UTC times you need to add a Z at the end of it.

See:

2.0.0-p247 :003 > Time.xmlschema '2013-08-26T06:43:53'
=> 2013-08-26 06:43:53 +0900 
2.0.0-p247 :004 > Time.xmlschema '2013-08-26T06:43:53Z'
 => 2013-08-26 06:43:53 UTC 

The first one is converted to my local timezone. The second one is correct. So basically, if you book meetings in UTC, you'll have a bad time when you get them back. Am I wrong?

ebeigarts commented 11 years ago

I haven't implemented any kind of typecasting, there are # TODO: Add typecasting in attributes.rb, pull requests are welcome :)