On Sun, 10 Aug 2003, John Siracusa wrote:

> > If you only have a year and day of year, then having a from_day_of_year
> > constructor saves a _lot_ of calculation that end users have to do.
> > OTOH,
> > having to do 'DateTime->now(time_zone => "local")' isn't very onerous
> > at
> > all.
>
> ...unless that's the only way you will *ever* call now()! :)
> Seriously, who is calling now() *without* time_zone => 'local'
> arguments?  I haven't done so yet, and would like to hear some examples
> of this usage.

Me, because I know that 'local' won't always work ;)  I'd be more likely
to call it with an explicit time zone than with 'local'.

> Here's example of what I expect to be common usage.  Let's say someone
> want the default date range in the text fields on a web form to be "the
> past 30 hours."  Joe Perl Programmer is going to glance at the DT docs
> and then write:
>
>       $start = DateTime->now->subtract(hours => 30)->strftime(...);
>       $end   = DateTime->now->strftime(...);
>
> Joe Perl Programmer is going to be very surprised, IMO, and the fix is
> not to add warnings to the docs... ;)

Like I said, I think there are very good reasons not to default to local,
especially since that it won't necessarily work at all.


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to