Alexey
Alexey

Reputation: 656

Google Calendar Event -> Invalid date/time format: 0001-12-28T23:40:36-03:06:28

Hello Google Calendar API team,

We receive an event in Google cal feed using com.google.api.services.calendar.Calendar.Events.List.execute() that the library google-http-client-1.18.0-rc.jar:1.18.0-rc can't handle. How do you suggest we work around this problem?

{
   "kind": "calendar#event",
   "etag": "\"2814305416392000\"",
   "id": "...",
   "status": "confirmed",
   ...
   "created": "2014-08-03T21:47:50.000Z",
   "updated": "2014-08-05T01:41:46.086Z",
   "summary": "...",
   ...
   "start": {
   "dateTime": "0001-12-28T23:40:36-03:06:28"   <<<< the issue
   },
   "end": {
    "dateTime": "2014-08-23T21:00:00-03:00"


Caused by: java.lang.NumberFormatException: Invalid date/time format: 0001-12-28T23:40:36-03:06:28
    at com.google.api.client.util.DateTime.parseRfc3339(DateTime.java:290) ~[google-http-client-1.18.0-rc.jar:1.18.0-rc]
    at com.google.api.client.util.Data.parsePrimitiveValue(Data.java:430) ~[google-http-client-1.18.0-rc.jar:1.18.0-rc]
    at com.google.api.client.json.JsonParser.parseValue(JsonParser.java:841) ~[google-http-client-1.18.0-rc.jar:1.18.0-rc]
    ... 21 common frames omitted

Upvotes: 1

Views: 1452

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117254

I suspect your problem is that your start date is 0001-12-28T23:40:36-03:06:28

originalStartTime.dateTime

The time, as a combined date-time value (formatted according to RFC 3339). A time zone offset is required unless a time zone is explicitly specified in timeZone.

I would read though RFC 3339 but I don't think there is any way that 0001 is a valid year.

If that doesn't fix the problem you could either check the issue log or log it as an issue yourself Google-Calendar-api issues

Upvotes: 2

Related Questions