I'd like to have a field called "Due Date" that has a default value of 10 days from the current day. Is this possible? I don't see a way to do this using traditional methods, but perhaps it can be achieved through some creative javascript?
Not natively, but you're spot on with the javascript suggestion.
Try
{code}
<script language="javascript" type="text/javascript"><!--
var startChg = document.getElementById("customfield_10288");if (startChg) { var today=new Date() today.setDate(today.getDate()+7) startChg.value=today }// -->
"Bother!", said Pooh as he realised he didn't know how to do a code box in "Answers"
@Nic - everybody votes! -> : https://jira.atlassian.com/browse/ANSWERS-57
Thanks Nic! I'll give this a shot (adding a check to see if the value is currently empty before setting the default, of course).
You could also set up a post function using a groovy (or other) script that populates the dues date and add it to your workflow. While we did something similar to that with assigned date, though more complicated that what this would be. If you would like to see what we did you can read about it here.
Hi Nic Brough
Thanks for your answer and Javascript.
It has worked halfway for me. It does successfully fill in the date field. But the format is incorrect.
As you may know, JIRA's date field is formatted "dd/MMM/yy h:mm a"
But the new Date() gives it "DDD MMM DD YYYY hh:mm:ss timezone"
Eg: "Tue Dec 23 2014 15:15:23 GMT+1100 (AUS Eastern Daylight Time)"
And to top it off, we can't manually update the date anymore.
Does anyone know how to format the date correctly again?
It looks like you're new here. Sign in or register to get started.