javascript calendar to select year only.

Can we use calendar to select only - Year. And no month-date should be selectable .

I am using below calendar which allows me to select date-month-year.

But i want it to be fix for - "Nov" as a month and Year can be selectable.

<script language="javascript" type="text/javascript">
	                                
		Calendar.setup({
			firstDay : 1,
			inputField : '${customField.id}:input1',
			button : '${customField.id}:input1-trigger',
			align : 'Br',			
			singleClick : false,
			useISO8601WeekNumbers : false,
			ifFormat : '%m/%Y'
		});
	
                                    if( Date.prototype.__msh_oldSetFullYear == null ) {
  Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
}
                                    </script>

please tell me how it could be configure to achieve this ?

1 answer

0 votes

No.

There's no configuration to be done here, the calendars simply do not support that. The date/time fields do not support it either, because the data being stored is, well, a date, which means you have to give it a day, month and year. They simply are not designed for just storing month and year.

You could try to bodge the existing popup with custom javascript, but I doubt it'll be simple, and you'll still have to think about how you store and retreive the data - my instinct would be to fix on a specific day of the month (e.g. the 7th) and always use that, while hiding it from the user.

Personally, I'd forget this approach, it's complex, messy, probably won't do what you want and exposes you to a nightmare during upgrade, let alone the initial coding.

I would write a custom field that only stores month and year, with an appropriate calender popup.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,760 views 11 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot