Edit*
Hi!
I am trying to do the same as the overdue field plugin. As it is right now not supporting JIRA 4.4.3. My only solution is to edit the templates to get the same result. No plugin for this time.
I have found following $content.getCurrentDate() and $dateutils.today().
I want to extract a number from these to dates that corresponds to how many days there are between.
I am using JIRA 4.4.3
* Edit
I have found new ways to complete this task by following code
#set( $difference = $currentMillis - $duedate.getTime() )
#set( $diffDays = $difference / (1000*60*60*24) )
The problem is now the first line. The substraction doesn't happen. And what I can see Jira doens't implement the mathTool. Is there any other way to complete this task?
Community moderators have prevented the ability to post new answers.
I found the following worked for me
$dueDateFormatter.parseDatePicker($dueDateFormatter.format($date)).compareTo($duedate)
It didn't work for me. I got 1 as answer all the time. Regardless what the duedate was set to.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I use Jira 4.4.3 and $date is null in duedate-columnview.vm, so
$dueDateFormatter.format($date) is the same as $dueDateFormatter.format(null)
$duedate is java.sql.Timestamp and the current date would be java.lang.Date so compareTo() should work
directly. But I cannot find any way to get the current date.
I want a solution where you don't have to parse a string (twice) to get Calendar.getInstance().
I have not found $dateutils.today(), only $dateutils.yesterday() and $dateutils.tomorrow(). :)
I cannot really understand why $dateutils.date($currentMillis) don't work?
I just gives me the literal text "$dateutils.date($currentMillis)". Maybe because the DateUtils class is not public?
According to the Velocity FAQ it may cause problems otherwise.
If I can use DateTool then everything would be easy. Does anyone know how I can add that tool to
the velocity context?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I use Jira 4.4.3 and $date is null in duedate-columnview.vm, so
$dueDateFormatter.format($date) is the same as $dueDateFormatter.format(null)
$duedate is java.sql.Timestamp and the current date would be java.lang.Date so compareTo() should work
directly. But I cannot find any way to get the current date.
I want a solution where you don't have to parse a string (twice) to get Calendar.getInstance().
I have not found $dateutils.today(), only $dateutils.yesterday() and $dateutils.tomorrow(). :)
I cannot really understand why $dateutils.date($currentMillis) don't work?
I just gives me the literal text "$dateutils.date($currentMillis)". Maybe because the DateUtils class is not public?
According to the Velocity FAQ it may cause problems otherwise.
If I can use DateTool then everything would be easy. Does anyone know how I can add that tool to
the velocity context?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not sure what you are exactly trying to do, but I have had good success inserting jQuery/JavaScript in Velocity Templates to manipulate output. Try inserting the following in the template as a test.
<script type="text/javascript">
jQuery(function($){
$(document).ready(function(){
var today = new Date();
alert( "${value} -"+ today);
});
});
</script>
Also, what version of JIRA are you using? The columunview templates have been modified in recent version and I believe there are some that are no longer used. I hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can use javascript. But it's a dirty solution to my dirty solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.