Re: REQ: Additional 'truncate' option

2007-10-01 Thread Rick Measham

Zefram wrote:

That doesn't do what was requested: if you start with a Sunday then it
moves a week back rather than just going to the beginning of the day.
But this will work:

$dt->add( days => 1 )->truncate( to => 'week' )->subtract( days => 1 );


Ahhh! I knew there was something more complex to it! Thanks Zefram, that 
fixes the problem I had with the task originally.


Cheers!
Rick Measham


smime.p7s
Description: S/MIME Cryptographic Signature


Re: REQ: Additional 'truncate' option

2007-10-01 Thread Rick Measham

Dave Rolsky wrote:

I see it's use, but it's really easy to do already:
 $dt->truncate( to => 'week' )->subtract( days => 1 );


Ahh crap!

All it takes is another set of eyes. My code to do it belongs on the 
daily-wtf!


Cheers!
Rick Measham


smime.p7s
Description: S/MIME Cryptographic Signature


Re: REQ: Additional 'truncate' option

2007-10-01 Thread Zefram
Dave Rolsky wrote:
> $dt->truncate( to => 'week' )->subtract( days => 1 );

That doesn't do what was requested: if you start with a Sunday then it
moves a week back rather than just going to the beginning of the day.
But this will work:

$dt->add( days => 1 )->truncate( to => 'week' )->subtract( days => 1 );

-zefram


Re: REQ: Additional 'truncate' option

2007-09-30 Thread Dave Rolsky

On Thu, 13 Sep 2007, Rick Measham wrote:

Is there any chance we can have ->truncate( to => 'Sunday' ) for truncating 
to week-beginning-on-sunday?


Heh, you got Warnocked.

I see it's use, but it's really easy to do already:

 $dt->truncate( to => 'week' )->subtract( days => 1 );


-dave

/*===
VegGuide.Orgwww.BookIRead.com
Your guide to all that's veg.   My book blog
===*/


REQ: Additional 'truncate' option

2007-09-12 Thread Rick Measham
Is there any chance we can have ->truncate( to => 'Sunday' ) for 
truncating to week-beginning-on-sunday?


Cheers!
Rick Measham


smime.p7s
Description: S/MIME Cryptographic Signature