drallgood/jpasskit

relevantDate wrong format "relevantDate":"2020-04-26T02:10:09Z"

sascha-hack opened this issue · 3 comments

the relevantDate is "relevantDate":"2020-04-26T02:10:09Z"

Apple is wants something with the timezone

"relevantDate" : "2020-04-26T02:10-08:00"

Seems like there are some fixes in the past, but it seems to be broken again.

I use following gradle import

compile group: 'de.brendamour', name: 'jpasskit', version: '0.1.2'

Weird that the builderr example is not available with this include.

I got everthing working, besides the rerlevantDate format

@sascha-hack
Thanks for the report.
According to Apple, that format is still correct:
https://developer.apple.com/library/archive/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/TopLevel.html#//apple_ref/doc/uid/TP40012026-CH2-SW2

it says W3C format which is documented here:
https://www.w3.org/TR/NOTE-datetime

We did change the format in 0.1.2 to match that:

jsonObjectMapper.configOverride(Date.class).setFormat(JsonFormat.Value.forPattern("yyyy-MM-dd'T'HH:mm:ssXXX"));

it's a SImpleDateFormat pattern for ISO 8601 formatting.
See also:
https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

So, I'd say that's correct.
In some cases, your local date might be converted into a UTC date (then it uses the Z timezone). Which is still correct.

See also our test for this:

Forgot to mention:
The builder is only available in 0.2.0 which I haven't released yet

I see. Thank you for the quick response.

So I need to have my date in UTC available. I think a problem is, that utils.Date does usually not have a timezone. Or am I wrong?

Ill try it with UTC and see if that works. Location does work perfectly already.

Thank you