Skip Menu |

This queue is for tickets about the Finance-Quote CPAN distribution.

Report information
The Basics
Id: 54143
Status: new
Priority: 0/
Queue: Finance-Quote

Owner: Nobody in particular
Requestors: user42 [...]

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

Subject: isoTime on "4pm" without minutes
Date: Sat, 30 Jan 2010 11:54:22 +1100
To: bug-Finance-Quote [...]
From: Kevin Ryde <user42 [...]>
Download (untitled) / with headers
text/plain 381b
In my RBA module I wanted to convert a time like "4pm" with isoTime(), use strict; use warnings; use Finance::Quote; print Finance::Quote->isoTime('4pm'),"\n"; It'd be good if that function had the minutes field optional. Perhaps something easy like below, or maybe tighter so a plain number input like "4" is not accepted (only "4pm" or "4:00" or "4h00" etc).
text/x-diff 627b
diff --git a/lib/Finance/ b/lib/Finance/ index 320a3b9..a6dca9f 100644 --- a/lib/Finance/ +++ b/lib/Finance/ @@ -759,8 +759,8 @@ sub isoTime { $timeString =~ tr/ //d ; $timeString = uc $timeString ; my $retTime = "00:00"; # return zero time if unparsable input - if ($timeString=~m/^(\d+)[\.:UH](\d+)(AM|PM)?/) { - my ($hours,$mins)= ($1-0,$2-0) ; + if ($timeString=~m/^(\d+)(?:[\.:UH](\d+))?(AM|PM)?/) { + my ($hours,$mins)= ($1-0,$2||0) ; $hours-=12 if ($hours==12); $hours+=12 if ($3 && ($3 eq "PM")) ; if ($hours>=0 && $hours<=23 && $mins>=0 && $mins<=59 ) {

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

Please report any issues with to