Mantis - Squeak
Viewing Issue Advanced Details
7255 Kernel feature always 12-30-08 12:25 05-03-13 21:27
M8R  
FrankShearar  
normal  
resolved  
fixed  
none    
none  
0007255: Add an #ago message to Duration
Saying "10 minutes ago" is easier than "DateAndTime now - 10 minutes."

Duration>>ago

^ DateAndTime now - self
 Duration-ago.st [^] (200 bytes) 01-01-09 16:03
 Duration-fromNow.st [^] (204 bytes) 01-01-09 16:29
 DurationTest-testAgo.st [^] (470 bytes) 01-01-09 16:30
 DurationTest-testFromNow.st [^] (506 bytes) 01-01-09 16:30

Notes
(0012887)
wiz   
12-31-08 21:06   
Hi M8R,

To further your cause would you please:

Upload a fileout with the method.

And if you can write a sunit tests to that there is something that fails before and passes after the patch is added.

This could be as simple as

testAgo

self shouldnt: [ 10 minutes ago ] raise: Error .

In a suitably named subclass of TestCase.
Upload the test stuff separately from the fileout.

hth,

Yours in curiosity and service, --Jerome Peace
(0012888)
M8R   
01-01-09 16:33   
Above are the fileOuts of the methods. I also added a #fromNow message to complement #ago, so one can say "5 days fromNow" and it will return the appropriate DateAndTime object.

(0014284)
nicolas cellier   
01-05-13 01:23   
I like this suggestion.

I would have prefered ahead among suggestions from http://english.stackexchange.com/questions/24457/general-purpose-antonym-for-ago [^] but google translates 'two days ahead'->'deux jours avant' which I suddenly find quite ambiguous... Hence was a bit harder (unknown) for me

In french we would say 'il y a deux jours' for past and 'dans deux jours' for future, but prefixing is not Smalltalkish.
So the opinion of a bloody french might not really matters for such subject...
(0014357)
FrankShearar   
05-03-13 21:27   
Kernel-cmm.758 & KernelTests-fbs.249 in Trunk.