How do i set the first day of week so that startofweek() returns Monday instead of Sunday?

Server and Local computer both have same correct locale and have Monday as first day of week.

Using JIRA 5.2.1

5 answers

1 accepted

Australia locale appears set as Sunday first day.

To override, need to set JVM parameters on Jira service to language and country that is set for Monday e.g. Germany

-Duser.language=de

-Duser.country=DE

Make sure there are no spaces after the parameters.

Stress on that last line "Make sure there are no spaces after the parameters." ;)

David Currie Atlassian Team Feb 19, 2016

To add to this, it depends on the Java locale that is configured - by default Java picks up the locale of the operating system, and subsequently JIRA picks that up. If we take a look at http://docs.oracle.com/javase/8/docs/api/java/time/temporal/WeekFields.html, it shows us:

  • ISO-8601 starts on Monday.
  • Everything else starts on Sunday.

I haven't been able to find a definitive list of which locales are ISO-8601 - it appears Germany is one. smile

2 votes
Mizan Community Champion Dec 12, 2012

Try endOfWeek(-5d) or endOfWeek(-6d)

Please go through this ticket, this includes steps to change the start day of the week to Monday.

https://jira.atlassian.com/browse/JRA-9048

NOTE: Please test this activity on our test environment and make sure you backup the files before make any changes

My files are a bit different to what is referenced in JRA-9048, so perhaps i need to remove the '-1' ???

the macros.vm has $firstDay = $currentCalendar.firstDayOfWeek - 1

the datepicker2.jsp has firstDay : <%= Calendar.getInstance(locale).getFirstDayOfWeek()-1 %

All you need to do is -

    • Go to <install-jira>/atlassian-jira/webapps/includes/lib/calendar.
    • Open the Calendar.js file.
    • Look for the line -
      this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc.
    • Remoe the above line and add the below line instead -
this.firstDayOfWeek = 1; 

Restart your JIRA and check whether you can see the start date ofy of the week set to Monday. This worked for me!

This has changed the issue due date picker so it now shows Mon-Sun correctly, but the startofweek() function is still set to Sunday

hmm query for Due = StartOfWeek() still returns issue with due date on Sunday

I agree with Mizan.  If you want the current week to be Mon-Sun, use "startOfWeek(1d), endOfWeek(1d)".  If you want the previous week to be Mon-Sun, use "(startOfWeek(-6d), endOfWeek(-6d))", and so on.  smile  Easy!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

229 views 1 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