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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

564 views 25 15
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