Subject: | Delta_Format bug |
Date: | Sun, 27 Jan 2013 15:15:43 -0700 |
To: | bug-Date-Manip [...] rt.cpan.org |
From: | <sgarvey [...] n-c-s.net> |
Between 5.56 and 6.38 something changed that's breaking previously working code
Test script:
#!/usr/local/bin/perl
use strict;
use warnings;
use Date::Manip;
$ENV{TZ} = 'PDT';
my $date1 = ParseDate('January 1, 2001 10:06AM');
my $date2 = ParseDate('January 31, 2002 10:00PM');
my $delta = DateCalc($date1, $date2); #, \$err);
print "\$delta = $delta\n";
# Here's the $format
my $format = '%dh days %hd hours';
$delta = Delta_Format($delta, 2, $format);
print "\$delta (formatted) = $delta\n";
use strict;
use warnings;
use Date::Manip;
$ENV{TZ} = 'PDT';
my $date1 = ParseDate('January 1, 2001 10:06AM');
my $date2 = ParseDate('January 31, 2002 10:00PM');
my $delta = DateCalc($date1, $date2); #, \$err);
print "\$delta = $delta\n";
# Here's the $format
my $format = '%dh days %hd hours';
$delta = Delta_Format($delta, 2, $format);
print "\$delta (formatted) = $delta\n";
With 5.56, it correctly prints
$delta = +0:0:56:3:11:54:0
$delta (formatted) = 395 days 11.90 hours
$delta (formatted) = 395 days 11.90 hours
With 6.38 it prints
$delta = 0:0:0:0:9491:54:0
$delta (formatted) = 0.00 days 9491.90 hours
$delta (formatted) = 0.00 days 9491.90 hours
For my own purposes, I was using "%dt" with 5.56,
but that produces a "0" delta and only "%dyh" works correctly with 6.38