self assert: Date today = Date today. today := Date today translateTo: 2 hours. self assert: today = Date today Is this right?
Can somebody please clarify if this is a bug or feature? thanks On Jan 31, 2014, at 9:03 PM, Sebastian Sastre <SEBASTIAN@FLOWINGCONCEPT.COM> wrote:
self assert: Date today = Date today.
today := Date today translateTo: 2 hours. self assert: today = Date today
Is this right?
Sebastian, In my 3.0 image | today | today := Date today. (today translateTo: 2 hours) = today. => false But what are you trying to accomplish ? Dates are a bit ambiguous: my Feb 1st and your Feb 1st, in one sense they are the same, refer to the same date, but in another sense, yours started at a different point in time, right ? So are they equal ? Sven On 01 Feb 2014, at 14:01, Sebastian Sastre <sebastian@flowingconcept.com> wrote:
Can somebody please clarify if this is a bug or feature?
thanks
On Jan 31, 2014, at 9:03 PM, Sebastian Sastre <SEBASTIAN@FLOWINGCONCEPT.COM> wrote:
self assert: Date today = Date today.
today := Date today translateTo: 2 hours. self assert: today = Date today
Is this right?
On Feb 1, 2014, at 12:26 PM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
Sebastian,
In my 3.0 image
| today | today := Date today. (today translateTo: 2 hours) = today.
=> false
Yeah, here too
But what are you trying to accomplish ?
Detect the most simple equality in the most conventional way. A true when two dates refers to the same date of the calendar
Dates are a bit ambiguous: my Feb 1st and your Feb 1st, in one sense they are the same, refer to the same date, but in another sense, yours started at a different point in time, right ? So are they equal ?
Well dates are the same, thatâs the convention isnât it? Localisation and time is what's different there. If you want to have time involved in the equation the logic step given our options is that you use DateAndTime So, again⦠Is this a bug or a feature? 1. Feature: our convention is injecting time in dates so we are injecting an incompatibility with intuition in exchange of a surprising precision* 2. Bug: Date #= should not compare start *a precision that is redundant because DateAndTime also have the #translateTo: feature
Sven
On 01 Feb 2014, at 14:01, Sebastian Sastre <sebastian@flowingconcept.com> wrote:
Can somebody please clarify if this is a bug or feature?
thanks
On Jan 31, 2014, at 9:03 PM, Sebastian Sastre <SEBASTIAN@FLOWINGCONCEPT.COM> wrote:
self assert: Date today = Date today.
today := Date today translateTo: 2 hours. self assert: today = Date today
Is this right?
Why are you adding hours to a Date in the first place? I don't understand. Does that make it the next day or the same day 2 hours past the start of the day in whatever timezone you are in, intuitively? I vote: b. Bug. #= should compare calendar (gregorian, julian etc,), year, month, day or year, day # of year On Feb 1, 2014, at 12:26 PM, Sven Van Caekenberghe <sven@> wrote:
Sebastian,
In my 3.0 image
| today | today := Date today. (today translateTo: 2 hours) = today.
=> false
Yeah, here too
But what are you trying to accomplish ?
Detect the most simple equality in the most conventional way. A true when two dates refers to the same date of the calendar
Dates are a bit ambiguous: my Feb 1st and your Feb 1st, in one sense they are the same, refer to the same date, but in another sense, yours started at a different point in time, right ? So are they equal ?
Well dates are the same, thatâs the convention isnât it? Localisation and time is what's different there. If you want to have time involved in the equation the logic step given our options is that you use DateAndTime So, again⦠Is this a bug or a feature? 1. Feature: our convention is injecting time in dates so we are injecting an incompatibility with intuition in exchange of a surprising precision* 2. Bug: Date #= should not compare start *a precision that is redundant because DateAndTime also have the #translateTo: feature
Sven
On 01 Feb 2014, at 14:01, Sebastian Sastre <sebastian@> wrote:
Can somebody please clarify if this is a bug or feature?
thanks
On Jan 31, 2014, at 9:03 PM, Sebastian Sastre <SEBASTIAN@> wrote:
self assert: Date today = Date today.
today := Date today translateTo: 2 hours. self assert: today = Date today
Is this right?
-- View this message in context: http://forum.world.st/Comparing-dates-tp4740789p4741022.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
#translateTo: just shifts the timezone. So he's not adding hours to anything. Why are you adding hours to a Date in the first place? I don't understand. Does that make it the next day or the same day 2 hours past the start of the day in whatever timezone you are in, intuitively? I vote: b. Bug. #= should compare calendar (gregorian, julian etc,), year, month, day or year, day # of year sebastian@flowingconcept.com wrote
On Feb 1, 2014, at 12:26 PM, Sven Van Caekenberghe <
sven@
> wrote:
Sebastian,
In my 3.0 image
| today | today := Date today. (today translateTo: 2 hours) = today.
=> false
Yeah, here too
But what are you trying to accomplish ?
Detect the most simple equality in the most conventional way. A true when two dates refers to the same date of the calendar
Dates are a bit ambiguous: my Feb 1st and your Feb 1st, in one sense they are the same, refer to the same date, but in another sense, yours started at a different point in time, right ? So are they equal ?
Well dates are the same, thatâs the convention isnât it? Localisation and time is what's different there.
If you want to have time involved in the equation the logic step given our options is that you use DateAndTime
So, againâ¦
Is this a bug or a feature?
1. Feature: our convention is injecting time in dates so we are injecting an incompatibility with intuition in exchange of a surprising precision*
2. Bug: Date #= should not compare start
*a precision that is redundant because DateAndTime also have the #translateTo: feature
Sven
On 01 Feb 2014, at 14:01, Sebastian Sastre <
sebastian@
> wrote:
Can somebody please clarify if this is a bug or feature?
thanks
On Jan 31, 2014, at 9:03 PM, Sebastian Sastre <
SEBASTIAN@
> wrote:
self assert: Date today = Date today.
today := Date today translateTo: 2 hours. self assert: today = Date today
Is this right?
-- View this message in context: http://forum.world.st/Comparing-dates-tp4740789p4741029.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Please use #assert:equals (that won't change the result though :-)) On Feb 1, 2014 12:04 AM, "Sebastian Sastre" <sebastian@flowingconcept.com> wrote:
self assert: Date today = Date today.
today := Date today translateTo: 2 hours. self assert: today = Date today
Is this right?
Is it a feature or a bug????????? On Feb 3, 2014, at 4:37 AM, Damien Cassou <damien.cassou@gmail.com> wrote:
Please use #assert:equals (that won't change the result though :-))
On Feb 1, 2014 12:04 AM, "Sebastian Sastre" <sebastian@flowingconcept.com> wrote: self assert: Date today = Date today.
today := Date today translateTo: 2 hours. self assert: today = Date today
Is this right?
participants (4)
-
Damien Cassou -
Paul DeBruicker -
Sebastian Sastre -
Sven Van Caekenberghe