TrustTheVote-Project / horatio-client

A client for an absentee ballot request form.
MIT License
2 stars 4 forks source link

Reduce precision of signature date field #18

Closed waldoj closed 9 years ago

waldoj commented 9 years ago

It's providing precision down to the microsecond, e.g. 2015-06-20T13:15:47.42Z, but the spec only support seconds, e.g. 2015-06-20T13:15:47Z, causing the JSON to fail the validation check.

waldoj commented 9 years ago

The problem appears to be that toISOString() produces greater precision than JSON's date datatype supports. The solution is probably to manually format the date-time.

waldoj commented 9 years ago

Notably, and appropriately, both use ISO 8601. In theory, microseconds are supported. In practice—in the case of our JSON schema library—it is not.

waldoj commented 9 years ago

Well, that was a horrible solution. Now the date-time string is being assembled manually, because that proved the simplest way to eliminate microseconds. (Other possibilities: a third-party library like Moment.js, or a regex.) But that fixes the problem. :-/