w3c-ccg / did-spec

Please see README.md for latest version being developed by W3C DID WG.
https://w3c.github.io/did-core/
Other
124 stars 45 forks source link

[Question] DateTime vs Millisecond Timestamp #275

Closed mehranshakeri closed 5 years ago

mehranshakeri commented 5 years ago

Could you please explain why timestamp values are set as formatted DateTime instead of something like Unix Epochs? e.g. Created property. Is there any pros except human-readability? My assumption is that DIDs will be used mainly by machines and my experience is having a Long value is much more developer friendly than a formatted String.

dlongley commented 5 years ago

@mehranshakeri,

There are a number of considerations that support using a formatted DateTime rather than a UNIX timestamp. These include at least:

  1. JSON parsing issues with large numbers
  2. Year 2038 issues with UNIX timestamps
  3. Priority of Constituencies

We can avoid the first two problems entirely by using a standard string representation of a date, and since this is not that difficult to do for developers, it makes a lot of sense given issue 3. Developers/DID ledgers/networks/etc. can, of course, represent values in any preferred lossless way internally; the formatted date string is only for the standard representation.

mehranshakeri commented 5 years ago

@dlongley Thank you for quick and detailed reply :)