ehn-dcc-development / hcert-kotlin

Kotlin multiplatform implementation of the HCERT/DCC specification
Apache License 2.0
25 stars 25 forks source link

JsDateSerializer: serialize the full date including time and tz info #64

Closed lazka closed 2 years ago

lazka commented 2 years ago

JsDateSerializer is used for serializing the dates in the metaInformation property of the validation result. Up until now it ignored any time and timezone information which resulted in loss of information when using the API from javascript.

Make it de/serialize the full ISO date string instead so no information is lost.

Fixes #61

lazka commented 2 years ago

The current code seems deliberate in throwing out that info, so I might be missing something.

CI will likely fail without #63 (at least I couldn't get it it pass).

With this change I get the following in JS:

{
    "expirationTime": "2022-07-15T13:32:58.000Z",
    "issuedAt": "2021-07-15T13:32:58.000Z",
    "issuer": "AT",
    "certificateValidFrom": "2021-05-05T12:41:06.000Z",
    "certificateValidUntil": "2023-05-05T12:41:06.000Z",
    "certificateValidContent": ["TEST", "VACCINATION", "RECOVERY"],
    "certificateSubjectCountry": "AT",
    "content": ["RECOVERY"],
    "error": null
}
nodh commented 2 years ago

That was simply a faux pas from my side, it should have serialized all information.