Jira Timezone javascript

Hi Guys,

I'm trying to implement the javascript for timezones:

Your timezone. The value is set automatically from your browser, so please only modify if it's incorrect. <br>
<b><a href="http://www.worldtimezone.com/" target="timezone">World Timezones</a></b>

<script language="JavaScript">

<!--
function setCustomerTimezone()
{
tzlist = document.getElementById("customfield_13423");
if (tzlist) {
if (/CreateIssueDetails.jspa/.test(tzlist.form.action)) {
// Value has not yet been set if (tzlist.value == -1) {
offset = new Date().getTimezoneOffset() / 60; // hours from GMT
if (offset <= 0) { tzlist.value="GMT+"+(-offset); }
else { tzlist.value = "GMT-"+offset; }
// }
}
}
}

window.onload = setCustomerTimezone;

//-->
</script>

But as stated on the Atlassian guide, it doesn't work beyond 4.3. This seems to be due to the new overlay create issue screen, which "CreateIssueDetails.jspa" obviously doesn't reference.

If I create an issue in the "http://jira-dev.site.com/secure/CreateIssue!default.jspa", this script will work (as was the method you created issues during 4.3.

Does anyone know how to get this working in 6.x? Even if it's a post-function? Atlassian seem to have gotten it working by removing the ability to have an overlay create screen, and effectively going back to a non-overlay method of creating an issue.

Many thanks!

1 answer

Hi Tim,

I tried the following:

Your timezone. The value is set automatically from your browser, so please only modify if it's incorrect. <br>
<b><a href="http://www.worldtimezone.com/" target="timezone">World Timezones</a></b>

<script type="text/javascript">
<!--
jQuery(document).ready(function($) {
setCustomerTimezone();
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { setCustomerTimezone(); });
});


function setCustomerTimezone()
{
tzlist = document.getElementById("customfield_13423");
if (tzlist) {
if (/CreateIssueDetails.jspa/.test(tzlist.form.action)) {
// Value has not yet been set if (tzlist.value == -1) {
offset = new Date().getTimezoneOffset() / 60; // hours from GMT
if (offset <= 0) { tzlist.value="GMT+"+(-offset); }
else { tzlist.value = "GMT-"+offset; }
// }
}
}
}

window.onload = setCustomerTimezone;

//-->
</script>

Doesn't seem to work unfortunately, my javascripting is somewhat.....poop, so I could have gotten it wrong.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

78 views 0 3
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