From 5de354af86a20c3422a436f1611b7c29702a490a Mon Sep 17 00:00:00 2001 From: snowleo Date: Tue, 23 Aug 2011 13:20:35 +0200 Subject: [PATCH] midnight = 12am noon = 12pm --- .../earth2me/essentials/DescParseTickFormat.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java b/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java index a64f8e3c7..0fd2e9047 100755 --- a/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java +++ b/Essentials/src/com/earth2me/essentials/DescParseTickFormat.java @@ -155,10 +155,6 @@ public final class DescParseTickFormat int hours = 0; int minutes = 0; - if (desc.endsWith("pm")) - { - hours += 12; - } desc = desc.toLowerCase().replaceAll("[^0-9]", ""); @@ -189,6 +185,16 @@ public final class DescParseTickFormat { throw new NumberFormatException(); } + + if (desc.endsWith("pm") && hours != 12) + { + hours += 12; + } + + if (desc.endsWith("am") && hours == 12) + { + hours -= 12; + } return hoursMinutesToTicks(hours, minutes); }