Author: bklaas
Date: Fri Aug 1 15:28:51 2008
New Revision: 2752
URL: http://svn.slimdevices.com?rev=2752&root=Jive&view=rev
Log:
Bug: 8871
Description: correctly convert pm times sent in ampm formatted time input to
secondsFromMidnight method
Modified:
7.2/trunk/squeezeplay/src/squeezeplay/share/jive/utils/datetime.lua
Modified: 7.2/trunk/squeezeplay/src/squeezeplay/share/jive/utils/datetime.lua
URL:
http://svn.slimdevices.com/7.2/trunk/squeezeplay/src/squeezeplay/share/jive/utils/datetime.lua?rev=2752&root=Jive&r1=2751&r2=2752&view=diff
==============================================================================
--- 7.2/trunk/squeezeplay/src/squeezeplay/share/jive/utils/datetime.lua
(original)
+++ 7.2/trunk/squeezeplay/src/squeezeplay/share/jive/utils/datetime.lua Fri Aug
1 15:28:51 2008
@@ -271,11 +271,24 @@
local i = 1
local secondsFromMidnight = 0
local _hhmm = tostring(hhmm)
+ log:warn(_hhmm)
for element in string.gmatch(_hhmm, "(%d%d)") do
-- element 1 is hh, element 2 is mm
timeElements[i] = tonumber(element)
i = i+1
end
+
+ -- convert ampm hours to 24h for method calculation
+ if string.find(_hhmm, 'p') then
+ if timeElements[1] ~= 12 then
+ timeElements[1] = timeElements[1] + 12
+ end
+ elseif string.find(_hhmm, 'a') then
+ if timeElements[1] == 12 then
+ timeElements[1] = 0
+ end
+ end
+
-- punt if this isn't a valid hh mm array
if (timeElements[1] > 23 or timeElements[2] > 59) then
return secondsFromMidnight
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins