Jira Timezone javascript

IT Support September 24, 2013

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

0 votes
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2013
IT Support September 25, 2013

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