How do you use jira calendar setup in the plugin for date picker?

I use following code to setup Calendar in my jira plugin:

Calendar.setup({
firstDay : 0,
inputField : 'releasedate',
button : 'releasedate-trigger',
align : 'Br',
singleClick : true,
useISO8601WeekNumbers : false,
ifFormat : '%m/%d/%Y',
daFormat : '%m/%d/%Y'
});

The field is defined as following:

<div class="field-group aui-field-datepicker">
<label for="releasedate">Release Date<span class="aui-icon icon-required"></span>
<span class="content"> required</span></label> <input
id="releasedate" class="text medium-field" type="text"
name="releasedate"/> <a id="releasedate-trigger"
title="Select a date" href="#"> <span
class="aui-icon icon-date">Select a date</span> </a>
</div>

My question is:

1. Is this correct way to use the date picker?

2. Is there a way I can use the date formats used everywhere else in JIRA? I don't want the plugin to stick out with its different date format. I can probably change my format to match default JIRA format, but if user decides to change the default format - my format will look different.

Thanks

2 answers

1 accepted

Accepted Answer
0 votes
Timothy Chin Community Champion May 18, 2013

If you want to use the system format, then you will have to call the format and parse it to the Javascript.

Thanks, how do you go about doing it? I was hoping for some javascript setup method that can be called to setup calendar date format..

Timothy Chin Community Champion May 18, 2013

applicationProperties.getDefaultBackedString(APKeys.xxx);

Thanks, do you know where these keys are documented?

Timothy Chin Community Champion May 18, 2013

No. Google them or open up the source code.

Thanks for the help. I was hoping for something simple in Javascript using AUI or just AJS.setupCalendar(..) kind of thing. But it is what it is - Appreciate you taking time to answer this.

I also found in the forum this example.

The answer in this example:

public String getJiraDateFormat(ApplicationProperties applicationProperties) {
String format = applicationProperties.getDefaultBackedString(APKeys.JIRA_LF_DATE_DMY);
return format;
}

The property that I needed was

"jira.lf.date.dmy" , that is APKeys.JIRA_LF_DATE_DMY

Hi Abhijit,

Why you don't use this ?

&lt;input class="text medium-field" id="preprodDate" name="preprodDate" type="text" value="#esc($!duedate)" /&gt;
    	&lt;a href="#" id="preprodDate-trigger" title="$i18n.getText('date.picker.select.date')"&gt;
        	&lt;span class="aui-icon icon-date"&gt;$i18n.getText('date.picker.select.date')&lt;/span&gt;
    	&lt;/a&gt;
    	#datePopup("preprodDate" "preprodDate-trigger" $dateTimeFormat $dateFormat $timeFormat true $currentMillis $currentCalendar)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 7 hours ago in Featured Groups

Tuesday tips & tricks: What is the Atlassian Community?

It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...

16 views 0 1
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you