Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 25526 invoked from network); 9 Jun 2008 07:17:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jun 2008 07:17:46 -0000 Received: (qmail 12839 invoked by uid 500); 9 Jun 2008 07:17:48 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 12785 invoked by uid 500); 9 Jun 2008 07:17:48 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 12776 invoked by uid 99); 9 Jun 2008 07:17:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jun 2008 00:17:48 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jun 2008 07:17:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D503023889BA; Mon, 9 Jun 2008 00:17:24 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r664643 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DateUtils.java Date: Mon, 09 Jun 2008 07:17:24 -0000 To: commits@commons.apache.org From: bayard@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080609071724.D503023889BA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bayard Date: Mon Jun 9 00:17:24 2008 New Revision: 664643 URL: http://svn.apache.org/viewvc?rev=664643&view=rev Log: Applying Robert Scholte's fix for LANG-440, replicating the SEMI_MONTH logic for AM_PM requests Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DateUtils.java Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DateUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DateUtils.java?rev=664643&r1=664642&r2=664643&view=diff ============================================================================== --- commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DateUtils.java (original) +++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/time/DateUtils.java Mon Jun 9 00:17:24 2008 @@ -829,6 +829,18 @@ val.add(Calendar.DATE, -15); val.add(Calendar.MONTH, 1); } +// ----------------- Fix for LANG-440 ---------------------- START --------------- + } else if (field == Calendar.AM_PM) { + // This is a special case + // If the time is 0, we round up to 12, otherwise + // we subtract 12 hours and add 1 day + if (val.get(Calendar.HOUR_OF_DAY) == 0) { + val.add(Calendar.HOUR_OF_DAY, 12); + } else { + val.add(Calendar.HOUR_OF_DAY, -12); + val.add(Calendar.DATE, 1); + } +// ----------------- Fix for LANG-440 ---------------------- END --------------- } else { //We need at add one to this field since the // last number causes us to round up