spdx / LicenseListPublisher

Tool that generates license data found in the license-list-data repository from the license-list-XML source
Apache License 2.0
11 stars 18 forks source link

Use ISO-8601 format for CrossRef timestamp #124

Closed rgmz closed 2 years ago

rgmz commented 2 years ago

The current CrossRef timestamp format is yyyy-MM-dd - HH:mm:ss, which requires a custom formatter to parse and has an ambiguous timezone (I sought out this repository to double-check whether it was UTC):

# This example is using Java, but the challenge is the same regardless of language.
jshell> import java.time.ZonedDateTime;
jshell> ZonedDateTime.parse("2021-10-28 - 17:35:32");
|  Exception java.time.format.DateTimeParseException: Text '2021-10-28 - 17:35:32' could not be parsed at index 10
...
jshell> import java.time.format.DateTimeFormatter;
jshell> ZonedDateTime.parse("2021-10-28 - 17:35:32", DateTimeFormatter.ofPattern("uuuu-MM-dd - HH:mm:ss");
| Exception java.time.format.DateTimeParseException: Text '2021-10-28 - 17:35:32' could not be parsed: ... Unable to obtain ZoneId from TemporalAccessor...

While this — admittedly — is a very minor issue, it would be nice for the license-list-data to use ISO-8601 timestamps, which are unambiguous and simple to parse (e.g. ZonedDateTime.parse("2021-10-28T17:35:32Z")).

goneall commented 2 years ago

@rgmz Completely agree with you on this issue. Thanks for pointing this out.

There is a standard SPDX time/date format: yyyy-MM-dd'T'HH:mm:ss'Z' which should be used - looks like the same as you are recommending.

I don't think it would break anything to switch formats over to the standard - I'll create a PR.

goneall commented 2 years ago

Resolved with PR #125