Ron Hill wrote:
>
> Do you think we can add to the docs to state these
> are "getter" methods? something like
>
> * min / max
[...]
> These methods are "getter" methods meaning you
> can't use it to set/change the value.
How about:
These methods return a copy of the actual
boundary values, meaning you can't use them to
set/change the value.
>
> I am writing boring monthly reports, extracting
data from
> an Ingres database. I just need the starting/ending
dates for
> the month. On an up note I was able to create a
DateTime::Format::Ingres
> module for this project( a real quick hack of the
Mysql module).
The easiest way to build the "current month" is
using the "before" parameter in DT::Span:
use DateTime::Span;
$month = DateTime->today->truncate( to => month );
$dt_span = DateTime::Span->from_datetimes(
start => $month->clone,
before => $month->add( months => 1 ),
);
print $dt_span->min, " ", $dt_span->max, "\n";
print $month, " is out of this span\n"
unless $dt_span->contains( $month );
# 2004-12-01T00:00:00 2005-01-01T00:00:00
# 2005-01-01T00:00:00 is out of this span
- Flavio S. Glock