Thanks Adrian. But that doesn't seem to give the expected results either.
Here is what I switched to:
com.ibm.icu.util.Calendar cal = new com.ibm.icu.util.GregorianCalendar();
java.util.Date start = UtilDateTime.toDate("06/01/2011 00:00:00");
cal.setTime(start);
GenericValue temporalExpression = delegator.findOne("TemporalExpression",
UtilMisc.toMap("tempExprId", "INDEPENDENCE_DAY"), true);
TemporalExpression selectionDeadline =
TemporalExpressionWorker.makeTemporalExpression(delegator,
temporalExpression);
for (int index = 0; index < 60; index++)
{
com.ibm.icu.util.Calendar first = selectionDeadline.first(cal);
Date nextDate = new
Date(selectionDeadline.next(first).getTimeInMillis());
Debug.logInfo(String.format("%s -> %s -> %s",
UtilDateTime.toDateString(new Date(cal.getTimeInMillis())),
UtilDateTime.toDateString(new Date(first.getTimeInMillis())),
UtilDateTime.toDateString(nextDate)),
"Groovy");
cal.add(com.ibm.icu.util.Calendar.DATE, 1);
}
With calling te.first() and passing the result to te.next(). It always
outputs 7/4/2012.
Perhaps I need to check the result of te.first() first? Like this:
for (int index = 0; index < 60; index++)
{
com.ibm.icu.util.Calendar first = selectionDeadline.first(cal);
com.ibm.icu.util.Calendar nextCal;
if (first > cal)
{
nextCal = first
}
else
{
nextCal = selectionDeadline.next(first);
}
Debug.logInfo(String.format("%s -> %s -> %s",
UtilDateTime.toDateString(new Date(cal.getTimeInMillis())),
UtilDateTime.toDateString(new Date(first.getTimeInMillis())),
UtilDateTime.toDateString(new Date(nextCal.getTimeInMillis()))),
"Groovy");
cal.add(com.ibm.icu.util.Calendar.DATE, 1);
}
Is that the intended use?
Thanks for your timely response.
-craig
--
View this message in context:
http://ofbiz.135035.n4.nabble.com/Do-Intersection-TemporalExpressions-work-tp4155989p4157247.html
Sent from the OFBiz - User mailing list archive at Nabble.com.