My preference from a code management perspective would be to not have
any code in OFBiz that we could include a library for, especially the
jakarta commons libraries as sooner or later we'll probably have all
of them in OFBiz anyway... ;)
-David
On Oct 6, 2006, at 7:24 PM, Jacques Le Roux wrote:
Hi John, Jacopo and Chris,
Perhaps before embedding the whole Apache's validator we may simply
add the below method as suggested John ?
If later we need more validations or other stuffes we migh include
Apache's tools (validator, math, etc.)
Jacques
----- Original Message -----
From: "John Martin" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, October 06, 2006 7:14 PM
Subject: Re: Date Comparison Function
The problem with that is that comparing datetime means that
10/06/2006
12:00:01 != 10/06/2006 18:30:00. I just want to see if a Date is the
same, before, or after another. The time messes up the tests.
I think using the commons/validator is the right thing to do since
the
less code we write, the less we have to maintain. On the otherhand,
my method is short and sweet.
/**
* compares two dates (excluding time) to determine if date A is
equal, before or after date B
* @param dateA a java.util.Date object
* @param dateB a java.util.Date object
* @return int a value of zero (0) indicates the dates are
equal; a value less than zero (< 0) date A is prior to B; and a
* value greater than zero (> 0) indicates
date A
occurs after B
*/
public static int compareDates(java.util.Date dateA,
java.util.Date dateB) {
String strDateA = UtilDateTime.toDateString(dateA,
"yyyyMMdd");
String strDateB = UtilDateTime.toDateString(dateB,
"yyyyMMdd");
return strDateA.compareTo(strDateB);
}