[squeak-dev] Date today versus DateAndTime today
marcel.taeumel at hpi.de
Thu Dec 9 09:40:29 UTC 2021
Hi Bernhard --
Date is a Timespan while DateAndTime is not. I think we should drop the timezone offset when converting a DateAndTime to a Date. Yet, the class comment of Date reads, that there are rare cases where one would need such an offset. Not sure.
In any case, "DateAndTime today" and "Date today" have different use cases. If you need an accurate timestamp, use DateAndTime. If you write an application that needs to handle time of some sorts (including calendars and games), use Date, Month, Week, Year.
Looking at the "STON" project, I find it strange that there are extensions on both DateAndTime and Date, given that this is primarily used in version control. You should only use DateAndTime in such scenarios.
Am 08.12.2021 23:22:03 schrieb Bernhard Pieber <bernhard at pieber.com>:
I am quite puzzled that the following answers false:
DateAndTime today asDate = Date today.
The reason seems to be the localOffsetSeconds. While DateAndTime today asDate has a local timezone, Date today has not. Shouldn’t this be consistent?
The following answers false as well:
Date today start = DateAndTime today
I assume it is for the same reason.
I suppose this is a feature, not a bug, but what is the reason for this behaviour?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev