On Sunday, August 10, 2003, at 09:40 PM, Dave Rolsky wrote:
...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'.

Yeah, but as the module's author, you're not exactly the "typical user" ;)


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.

Okay, fine, then don't default now() to 'local' to avoid that problem. But what's the argument against a localtime() that, say, croaks if it can't figure out what "local" is? I think that's a reasonable thing for a function named localtime() to do.


Do you not agree that getting the current local time will be a common task, and that Joe Programmer is not likely to be too keen on typing either time_zone => 'local' or time_zone => 'Asia/Taipei' (or whatever) everywhere?

-John



Reply via email to