<div dir="auto">We generally use upTo: when excluding like in Stream and primesUpTo:</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 11 mai 2019 à 20:05, Chris Cunningham <<a href="mailto:cunningham.cb@gmail.com">cunningham.cb@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">That does explain it.  So, datesDo: is fine.<div><br></div><div>Timespan>>to: is the method at issue.  The right-open intenterval is what tripped me up. Other implementations of #to: are right closed: (1 to: 2) includes 2, for instance, whereas (Date yesterday to: Date today) does not include today.</div><div><br></div><div>Time to: makes sense to me: '01:00:00' asTime to: '02:00:00' asTime being 1 hour makes sense to me, since it is a particular point in time to another particular point in time.</div><div>The Day to Day - I guess just assuming the 2nd day means the beginning of the day instead of the end of the day is what gets me.</div><div><br></div><div>I'd excpect Date today to: Date today to be today - not an empty timespan.</div><div><br></div><div>Maybe I just need to get over it.</div><div>But what I'd expect is the the end part of the timespan #to: to use the end of the ending timespan,if possible.</div><div><br></div><div>Thanks,</div><div>cbc</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 10, 2019 at 3:40 PM Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" target="_blank" rel="noreferrer">leves@caesar.elte.hu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, 10 May 2019, Chris Cunningham wrote:<br>
<br>
> So, this code:   Date today asMonth datesDo: [:date| Transcript cr; show: date yyyymmdd]<br>
> prints out each day in the month.  That is what I'd expect.<br>
> <br>
> This code:<br>
>   |mth|<br>
>   mth := Date today asMonth.<br>
>   (mth start asDate to: mth end asDate) datesDo: [:date| Transcript cr; show: date yyyymmdd]<br>
> does not print the last date.<br>
> <br>
> 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.<br>
> <br>
> Thoughts?<br>
<br>
I wrote a mail about this just two months ago[1]. Timespan, unlike <br>
Interval, is a right-open interval. It has to be in order to have the <br>
expected length. Date(Timespan) >> #to: will create a Timespan.<br>
<br>
Levente<br>
<br>
[1] <a href="http://forum.world.st/Testing-out-new-UTCDateAndTime-in-Squeak-5-3-alpha-td5096623.html" rel="noreferrer noreferrer" target="_blank">http://forum.world.st/Testing-out-new-UTCDateAndTime-in-Squeak-5-3-alpha-td5096623.html</a><br>
<br>
> <br>
> -cbc<br>
> <br>
><br>
</blockquote></div>
<br>
</blockquote></div>