Skip to content

Incorrect timestamp format in AndroidNotification.event_time #337

Description

@hiranya911

I think the way we format the event_time field on AndroidNotification is wrong:

public Builder setEventTimeInMillis(long eventTimeInMillis) {
this.eventTime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS'Z'")
.format(new Date(eventTimeInMillis));
return this;
}

There seems to be couple of issues with this.

  1. We are not specifying the timezone for the SimpleDateFormat. Therefore the resulting timestamp string is in the local timezone while the backend expects it to be in UTC.
  2. The way nanoseconds are formatted seems to be wrong. For the milliseconds value 1546304523123L this generates the string 2019-01-01T01:02:03.000000123Z. I would expect the nanos to be formatted as 123000000 (i.e. 123 milliseconds in nanos).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions