Added cases to accept both a.m./p.m. and AM/PM

This commit is contained in:
Dylan Leonard 2017-09-18 14:20:28 -04:00 committed by Dylan Leonard
parent db4d203437
commit 4f5987b72a

View file

@ -91,9 +91,9 @@ public class DateUtil {
if (m.find()) { if (m.find()) {
retval = SafeParse.stringToInt(m.group(1)) * 60 * 60 + SafeParse.stringToInt(m.group(2)) * 60; retval = SafeParse.stringToInt(m.group(1)) * 60 * 60 + SafeParse.stringToInt(m.group(2)) * 60;
if (m.group(3).equals(" AM") && m.group(1).equals("12")) if (m.group(3).equals(" a.m.") || m.group(3).equals(" AM") && m.group(1).equals("12"))
retval -= 12 * 60 * 60; retval -= 12 * 60 * 60;
if (m.group(3).equals(" PM") && !(m.group(1).equals("12"))) if (m.group(3).equals(" p.m.") || m.group(3).equals(" PM") && !(m.group(1).equals("12")))
retval += 12 * 60 * 60; retval += 12 * 60 * 60;
} }
return retval; return retval;