svenvc / ston

STON - Smalltalk Object Notation - A lightweight text-based, human-readable data interchange format for class-based object-oriented languages like Smalltalk.
MIT License
135 stars 32 forks source link

Why appending a Z on Date with UTC offset? #24

Closed marianopeck closed 5 years ago

marianopeck commented 5 years ago

Hi Sven,

Checking on Date >> stonOn: as well as in testDate I see that you append a trailing Z if the date is in UTC (offset = 0). What's the reasoning behind that? Why +00:00 is not enough? Finally, I don't see this defined/explained in the spec: https://github.com/svenvc/ston/blob/master/ston-spec.md#date

Any thoughts?

Thanks in advance,

svenvc commented 5 years ago

Well, it says so in the comment: since the current implementation of Date is timezone dependent (in Pharo and Squeak it is a timespan of 1 day starting at a DateAndTime that contains an offset, it is more than just a year/month/day, it is what it is).

+00:00 and Z are the same (ISO 8601 standard, Z being shorter).

Yes, it should be better explained in the new spec document.

This might be a bit implementation dependent, I guess. But STON can't solve all problems in the world, can it ;-)

marianopeck commented 5 years ago

Uhh sorry, I didn't know that +00:00 and Z meaning the same was part of ISO 8601 . Makes more sense now. Thanks for the explanation!

svenvc commented 5 years ago

https://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators