Both are java.lang.Long. But the pb doesn't come from the if statement. I
use a sortable table. And depending on the way I sort it (by clicking on the
header), I have completly random behavior (sometimes I have 3 red lines,
sometimes 6... weird)
<table id="todoTable" class="grid sortable filterable doOddEven"
cellpadding="0" cellspacing="0" border="0">
<tr class="sortHeader">
<th>N°</th>
<th>Titre</th>
<th>Description</th>
<th>Assignee</th>
<th>Date</th>
<th>Status</th>
</tr>
#set ($i=0)
#set ($today = $xwiki.currentDate.time)
#foreach ($todo in $todos)
#set ($todoDoc = $xwiki.getDocument($todo))
#set ($todoObj = $todoDoc.getObject("XWiki.TodoClass"))
#set ($i = $i + 1)
#if ($todoObj.getProperty("TargetDate").value.time < $today)
<tr style="color:White;background-color:Red;">
#else
<tr>
#end
<td>$i</td>
<td>[$todo]</td>
<td>$todoObj.Description</td>
<td>$todoObj.Assignee</td>
<td>$todoObj.TargetDate</td>
<td>$todoObj.Status</td>
</tr>
#end
</table>
Thanks,
Antonio
2008/10/17 Sergiu Dumitriu <sergiu(a)xwiki.com>
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
<antonio.mailing(a)gmail.com>
> 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 <sergiu(a)xwiki.com>
>
> 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/
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
--
Antonio Goncalves (antonio.goncalves(a)gmail.com)
Software architect
Paris JUG leader :