Skip to content
This repository was archived by the owner on Jun 18, 2024. It is now read-only.

Item.getDateTimeLastModified() returns wrong date #86

Closed
anihojnadel opened this issue Jun 1, 2015 · 1 comment
Closed

Item.getDateTimeLastModified() returns wrong date #86

anihojnadel opened this issue Jun 1, 2015 · 1 comment
Assignees
Labels

Comments

@anihojnadel
Copy link
Contributor

Adding issue from Gary Bentley in: Stack Overflow


I'm finding that a call to Item.getDateTimeLastModified() will consistently return an incorrect date/time. Most of the time, if an item has been recently updated, it will return a millisecond value (in the GMT time zone) that is anything up to 2 hours and a few minutes ahead of current GMT.

Other date times such as Event.getStart()/Event.getEnd() are returning the correct values.

When processing calendar events I am using the following to retrieve events:


ListenableFuture<List<Event>> eventsGet = this.userFetcher
                .getCalendar (this.calendarId)
                .getEvents ()
                .top (pageSize)
                .skip (skip)
                .select ("Id")
                .filter (modFromDate)
                .orderBy ("DateTimeLastModified")
                .read ();

List<Event> events = eventsGet.get (60,
                                TimeUnit.SECONDS);

Then I process the events one at a time and using the id get the actual event using:

this.userFetcher.getCalendar (this.calendarId).getEvent (id).read ().get (60, TimeUnit.SECONDS);

Calling getDateTimeLastModified on that event will return the strange value.

As an aside, I notice that the Office.com calendar when it retrieves the json data for the event has the correct last modified time.

@anihojnadel anihojnadel added the bug label Jun 1, 2015
@anihojnadel anihojnadel self-assigned this Jun 1, 2015
@anihojnadel
Copy link
Contributor Author

Fixed.

The issue was in the CalendarSerializer in the orc-for-java-shared package. The date returned by the server contains more than 3 milliseconds and SimpleDateFormat only support 3. Those extra milliseconds caused an error in datetime conversion and added some minutes to the orginal date. We removed extra milliseconds and it started working as expected.

The fix will be available in next orc-for-java-shared release (next Thursday 4th of June)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant