Calendar datetime comparison using == fail to fire rule when calendar object is created from parsed in date string with timezone offset

Solution In Progress - Updated -

Issue

Calendar datetime comparison of two dates using == fail to fire rule when one calendar object is created from parsed in date string with timezone offset while the other one is created manually but have same milliseconds.
e.g.

    ...
                Calendar parsedInDate = DatatypeConverter.parseDateTime("2018-11-23T00:00:00.000-06:00");
                Calendar setDate = Calendar.getInstance();
                setDate.setTimeInMillis(parssedInDateCal.getTimeInMillis());

                DateComparisonTest testData = new DateComparisonTest(parssedInDate,setDate);

                ksession.insert(testData);
                ksession.fireAllRules();
    ...

Here is problematic condition(LHS).

rule "dateEqualToEqualTest"
dialect "java"
when
    $dateComparisonTest : DateComparisonTest( parsedInDate == setDate)
then 
  ...

The same rule fire when compareTo of calendar object is used for comparison.

i.e.

         $dateComparisonTest : DateComparisonTest( parsedInDate.compareTo(setDate) >= 0)

Why does it fail? Is this a bug?

Environment

  • Red Hat JBoss BRMS
    • 6
  • MVEL2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In