[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Using Class::Date subclass instead of arrays and Date::Calc



BEFORE:

   my @sd = $self->DateConvert($o_RequestAvail->get_arrival_date,6);
   my @ed = $self->DateConvert($o_RequestAvail->get_depart_date,6);
   my $stay_nights = Delta_Days(@sd,@ed);

AFTER:

   my $sd = $o_RequestAvail->get_arrival_date('obj');
   my $ed = $o_RequestAvail->get_depart_date('obj');
   my $stay_nights = ($ed - $sd)->day;

We don't need 65 homebrew DateConvert() methods any more... or Date::Calc::Delta_Days()... and we can do automagical date subtraction! neato.

j