Planet icon indicating copy to clipboard operation
Planet copied to clipboard

Question about Date

Open zu1k opened this issue 3 years ago • 3 comments

I'm creating a small tool that works around planet.json, I found some Date type like created make me confused.

I think Date type should follow one of RFC 2822 \ RFC 3339 \ ISO 8601, this field should be readable, could you please make a change or give some kind of parsing specification ?

zu1k avatar Jun 10 '22 11:06 zu1k

Currently, it's directly from Swift JSON encoder for Swift's Date type, its raw form is a TimeInterval (=Double) of their milliseconds since the reference date: 12:00 a.m. UTC on January 1st, 2000.

livid avatar Jun 10 '22 11:06 livid

Thanks for your reply.

I am not familiar with swift, I wonder why Double, I think it should be some type of int if this means the count of milliseconds since a certain time.

Maybe it would be more appropriate to make changes in time for the early stages of the product.

decoder.dateDecodingStrategy = .iso8601
encoder.dateEncodingStrategy = .iso8601

zu1k avatar Jun 10 '22 12:06 zu1k

Thanks. But it would be a breaking change for previous versions.

livid avatar Jun 10 '22 12:06 livid