Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the DateManip CPAN distribution.

Report information
The Basics
Id: 14762
Status: resolved
Priority: 0/
Queue: DateManip

People
Owner: Nobody in particular
Requestors: explorer [...] joaquinferrero.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 5.44
Fixed in: (no value)



Subject: Problem with deltas dates with relative inline mode
Download (untitled) / with headers
text/plain 1.7k
DateManip-5.44 perl v5.8.7 Linux 2.4.26-1-686-smp #1 SMP Sat May 1 19:17:11 EST 2004 i686 GNU/Linux Problem: DateCalc function permit to use two formats of delta times: $date = DateCalc("today","+ 2 business days",\$err); or $date = DateCalc("today","+ 2 days",\$err,2); But the inline mode don't work: ----------------------------------------------------------- $ perl -MDate::Manip -le '$x = DateCalc("09/29/2005","+ 6 days",\$err,2); print $x,"\n",$err' 2005100708:00:00 $ perl -MDate::Manip -le '$x = DateCalc("09/29/2005","+ 6 business days",\$err); print $x,"\n",$err' 2005100500:00:00 ----------------------------------------------------------- Even in localised enviroment: ----------------------------------------------------------- $ perl -MDate::Manip -le 'Date_Init( "Language=Spanish", "DateFormat=non-US"); $x = DateCalc("29/09/2005", "+ 6 dias",\$err,2); print $x,"\n",$err' 2005100708:00:00 $ perl -MDate::Manip -le 'Date_Init( "Language=Spanish", "DateFormat=non-US"); $x = DateCalc("29/09/2005","+ 6 dias laborales",\$err); print $x,"\n",$err' 2005100500:00:00 ----------------------------------------------------------- The problem, I suspect, is into DateCalc routine. It use $mode variable to indicate the mode (exact, business, etc) to calculate the offset of date. The lines 1576-1583 call the correct subroutine to make the calc, but $mode is only changed if it is passed via argument to the DateCalc function, at lines 1527-1531. If the user pass the mode into the delta time, $mode is not changed. ------------------------------------------------ Solution: (not tested with all combinations!) Insert $mode = $Curr{"Mode"}; after the line } elsif ($tmp=&ParseDateDelta($D2)) { because ParseDateDelta change $Curr{"Mode"}.
From: SBECK [...] cpan.org
Download (untitled) / with headers
text/plain 397b
Show quoted text
> $ perl -MDate::Manip -le '$x = DateCalc("09/29/2005","+ 6 > days",\$err,2); print $x,"\n",$err' > 2005100708:00:00 > > $ perl -MDate::Manip -le '$x = DateCalc("09/29/2005","+ 6 business > days",\$err); print $x,"\n",$err' > 2005100500:00:00
This has been fixed in the version that is available from my home page at: http://www.cise.ufl.edu/~sbeck/ The next version will contain the fix.
Download (untitled) / with headers
text/plain 127b
The next release will contain the fix. In the meantime, you can get a patched version from: http://www.cise.ufl.edu/~sbeck/


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.