[squeak-dev] Timespan>>datesDo: - is this a bug?

Chris Cunningham cunningham.cb at gmail.com
Fri May 10 22:24:42 UTC 2019


So, this code:
   Date today asMonth datesDo: [:date| Transcript cr; show: date yyyymmdd]
prints out each day in the month.  That is what I'd expect.

This code:
  |mth|
  mth := Date today asMonth.
  (mth start asDate to: mth end asDate) datesDo: [:date| Transcript cr;
show: date yyyymmdd]
does not print the last date.

This has bitten me.  If I add a nanosecond onto the end date (mth end
asDate + 1) it does include the last date - but that is ugly.  And
dangerous if I have other code that carefully picks the following date
start to work around this oddity.

Thoughts?

-cbc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190510/12e719fc/attachment.html>


More information about the Squeak-dev mailing list