Antonio Goncalves wrote:
Hum, just a thought. Is it String comparaison or Long ? Do I have to cast it into Long ?
Just write $todoObj.getProperty("TargetDate").value.time.class $xwiki.currentDate.time.class to see the type of each term.
2008/10/16 Antonio Goncalves <[email protected]>
Thanks, it's working. I just have a funny behavior now when I compare these dates with the current date (converted to milliseconds) : #if ($todoObj.getProperty("TargetDate").value.time < $xwiki.currentDate.time)
Sometimes the if statement is correct and sometimes is not. When I print the values I see targetDate inferior to currentDate but the if statement is not executed. Strange.
Antonio
2008/10/16 Sergiu Dumitriu <[email protected]>
Antonio Goncalves wrote:
It's me again. I'm still confused by the property classes. The dueDate is of type DateProperty. How can have the milliseconds value of that date ? I've tried to format the date, but it doesn't work. If I display $todoObj.TargetDate, it's fine, but I can manipulate it as a date ( using formatDate for exemple)
#foreach ($todo in $todos) #set ($todoDoc = $xwiki.getDocument($todo)) #set ($todoObj = $todoDoc.getObject("XWiki.TodoClass"))
$todoObj.TargetDate // This works $xwiki.formatDate($todoObj.TargetDate, "yymmdd") // This does'n work #end
Do you know what to do to use formatDate on a DateProperty ?
$xwiki.formatDate($todoObj.getProperty("TargetDate").value, "yymmdd")
$todoObj.TargetDate formats the date into a string. $todoObj.getProperty("TargetDate").value is the actual value of the property, which is a Date for date properties.
-- Sergiu Dumitriu http://purl.org/net/sergiu/