Re: Request for DateTime API addition: today() constructor

2003-03-26 Thread Joshua Hoblitt
> yeah, but then we're bordering on a truly ridiculous number of > constructors, most of which are just syntactic sugar. I'm afraid I'm > going to go with Joshua's suggestion on this one. It "feels" right > because the other constructors already take a time_zone parameter, so this > one should to

Re: Request for DateTime API addition: today() constructor

2003-03-26 Thread Dave Rolsky
On Wed, 26 Mar 2003, Tim Bunce wrote: > > > now_local() > > > now_utc() > > > today_local() > > > today_utc > > > > Why not have the constructors take any timezone as an argument? > > > > ->now( 'utc' ) > > > > or > > > > ->now( timezone => 'local' ) > > > > or even > > > > ->now( timezone

Re: Request for DateTime API addition: today() constructor

2003-03-26 Thread Joshua Hoblitt
> > Why not have the constructors take any timezone as an argument? > > > > ->now( 'utc' ) > > > > or > > > > ->now( timezone => 'local' ) > > > > or even > > > > ->now( timezone => 'floating' ) > > > > If no arguments are specified you get still get UTC. > > You could, but I like the simplicity an

Re: Request for DateTime API addition: today() constructor

2003-03-26 Thread Tim Bunce
On Tue, Mar 25, 2003 at 09:42:30AM -1000, Joshua Hoblitt wrote: > On Tue, 25 Mar 2003, Tim Bunce wrote: > > > On Mon, Mar 24, 2003 at 06:59:17PM -0600, Dave Rolsky wrote: > > > On Mon, 24 Mar 2003, Joshua Hoblitt wrote: > > > > > > > > True. Though it'll be so commonly used I think it deserves a c

Re: Request for DateTime API addition: today() constructor

2003-03-25 Thread Joshua Hoblitt
On Tue, 25 Mar 2003, Tim Bunce wrote: > On Mon, Mar 24, 2003 at 06:59:17PM -0600, Dave Rolsky wrote: > > On Mon, 24 Mar 2003, Joshua Hoblitt wrote: > > > > > > True. Though it'll be so commonly used I think it deserves a constructor. > > > > > > Ditto. It would also be nice if it defaults to curr

Re: Request for DateTime API addition: today() constructor

2003-03-25 Thread Tim Bunce
On Mon, Mar 24, 2003 at 06:59:17PM -0600, Dave Rolsky wrote: > On Mon, 24 Mar 2003, Joshua Hoblitt wrote: > > > > True. Though it'll be so commonly used I think it deserves a constructor. > > > > Ditto. It would also be nice if it defaults to current TZ instead of a > > floating time. The same f

Re: Request for DateTime API addition: today() constructor

2003-03-24 Thread Dave Rolsky
On Mon, 24 Mar 2003, Joshua Hoblitt wrote: > > True. Though it'll be so commonly used I think it deserves a constructor. > > Ditto. It would also be nice if it defaults to current TZ instead of a > floating time. The same for ->now. Actually, both ->now and ->today default to UTC, because they

Re: Request for DateTime API addition: today() constructor

2003-03-24 Thread Joshua Hoblitt
On Mon, 24 Mar 2003, Tim Bunce wrote: > On Sun, Mar 23, 2003 at 08:35:49PM +, Rich wrote: > > Rick Measham wrote: > > > > >>my $today = DateTime->now; > > >>$today->truncate(to => "day"); > > > > > > From memory, this would work for you .. I can't test it here: > > > $today = DateTime->no

Re: Request for DateTime API addition: today() constructor

2003-03-24 Thread Rich
Rick Measham wrote: >>my $today = DateTime->now; >>$today->truncate(to => "day"); > > From memory, this would work for you .. I can't test it here: > $today = DateTime->now->truncate(to => "day"); > Certainly does and looks a lot nicer, thanks. -- Rich [EMAIL PROTECTED]

Re: Request for DateTime API addition: today() constructor

2003-03-22 Thread Dave Rolsky
On Sun, 23 Mar 2003, Rick Measham wrote: > >my $today = DateTime->now; > >$today->truncate(to => "day"); > > From memory, this would work for you .. I can't test it here: > $today = DateTime->now->truncate(to => "day"); Yep, that works. Maybe a FAQ? Also, I think a general FAQ on "I just w

Re: Request for DateTime API addition: today() constructor

2003-03-22 Thread Rick Measham
my $today = DateTime->now; $today->truncate(to => "day"); From memory, this would work for you .. I can't test it here: $today = DateTime->now->truncate(to => "day"); -- There are 10 kinds of people: those that understand bin

Request for DateTime API addition: today() constructor

2003-03-22 Thread Rich
my $today = DateTime->today; Like now(), but would set the year, month and day components only. Useful for date rather than datetime calculations, and nicer than: my $today = DateTime->now; $today->truncate(to => "day"); Many thanks, -- Rich [EMAIL PROTECTED]