Re: Re: Strptime issues
Flavio S. Glock [EMAIL PROTECTED] wrote: How about to extend the 'to_datetime' method, instead of creating a new one: if ($dti-can_be_datetime) { $dti = $dti-to_datetime } Sounds good .. and it's as simple as using DateTime-today as the base, which may well be a good default behaviour for -to_datetime when no base is in the object or none is passed in the call. Cheers! Rick
Re: Re: Re: Strptime issues
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: sub has_time { $_[0]-has{'hour', 'minute'} } Maybe should be: sub has_time { return 1 if ($_[0]-has('hour', 'minute') and not $_[0]-has('nanosecond')); return 1 if ($_[0]-has('hour', 'minute', 'second')) return 0 } Which only returns true if we have HH:MM or HH:MM:SS or HH:MM:SS.N+. The older version allowed us to get true for HH:MM:xx.N+ which is not really a time. Same caveat: Above code passes all tests on the perl installed in my head. Havn't tried any of it with the much fussier software version. perl -v This is perl, v5.8.0 built for ricks-brain-1.0
Re: Re: Strptime issues
David Hood [EMAIL PROTECTED] wrote: Perhaps you should return only the information that is given, in an iso 8601 compliant format, so for November 2003 you could simply return 2003-11. The Nah, that's not going to happen. The entire point of the module is to get a DateTime object. So it's either going to be a full DateTime or a DateTime::Incomplete. Also: What's the ISO format for 11pm November?