On 07/10/2012 07:36 AM, Hamster wrote:
Next challenge...

How can I compare dates with velocity?

It seems like the ComparisonDateTool is not implemented in XWiki
http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/generic/ComparisonDateTool.html

Again, on http://extensions.xwiki.org/xwiki/bin/view/Extension/Velocity+Module#HVelocityTools it states that $datetool is a reference to ComparisonDateTool.

What do you mean by "compare"? ComparisonDateTool only offers methods for computing the difference between two dates, but just "is after" or "is before" comparison is directly available in the Date class, so a simple:

$date1.after($date2)

should return true or false.

You can also compare the absolute time values using:

#if ($date1.getTime() >= $date2.getTime())
--
Sergiu Dumitriu
http://purl.org/net/sergiu/


_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to