There is a time zone offset != 0 in the toString-ed date.
-W

2011/2/10 Saloojee, Karim <karim.saloojee@fnb.co.za>
Hi

I am comparing SimpleAccount( dateAccountOpened == "5-Feb-2011")
where dateAccountOpened is "Sat Feb 05 00:00:00 GMT+02:00 2011" (if you
call toString()). The equal comparator fails (==) but the greater than
comparator passes (>) which I don't understand.

I feel I am missing something obvious here, but I have no idea what it
is.


rule "Test date equality"
       when
               $acc : SimpleAccount( dateAccountOpened == "5-Feb-2011")

       then
               System.out.println("Expected and found an account opened
on 5-Feb-2011: " + $acc);
end

rule "Some dates are more equal than others"
       when
               $acc : SimpleAccount( dateAccountOpened > "5-Feb-2011")

       then
               System.out.println("Unexpected match: " +
$acc.getDateAccountOpened());
end

Regards,
Karim

To read FirstRand Bank's Disclaimer for this email click on the following address or copy into your Internet browser:
https://www.fnb.co.za/disclaimer.html

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclaimer@fnb.co.za and we will send you a copy of the Disclaimer.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users