Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to make StartOfWeek and EndOfWeek use MON-SUN instead of SUN-SAT

Pablo Chacín Martínez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 19, 2022

I'm trying to retrieve the issues created last week using the following JQL clause


created >= startOfWeek(-1w) AND created <= endOfWeek(-1w)

However, it still returns issues created on Sunday two weeks ago, so it is effectively considering weeks going from SUN to SAT. 

The system configuration has the option "Use ISO8601 standard in Date Picker" enabled, but this does not affect the StartOfWeek/EndofWeek functions. 


May this issue be due to the fact default language is set to English US? 

 

 

1 answer

0 votes
Andy Rusnak
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 19, 2022

Hi Pablo, 

By default the startOfWeek and endOfWeek will use Sunday and Saturday respectively.  You can add a qualifier to shift that date from the default. 

In your example you provided, the -1w qualifier will move the default startOfWeek date back by one full week.  That is why you are getting issues from 2 weeks back.  

I believe what you would want to set it startOfWeek(+1d) and endOfWeek(+1d).  That should shift the start and end of the week defaults by one day (so from Sunday-Saturday to Monday-Sunday).  

Additional information/examples related to this can be found with the following documentation: 

startOfWeek()

endOfWeek()

Does this help to resolve your issue?  If I have misunderstood what you are attempting to do or if you have additional questions related to this I would be happy to discuss further.  

Best, 

Andy

Andy Rusnak
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 19, 2022

I am sorry Pablo, I just caught you wanted this for last week.  So in that case rather than the +1d, you would want to use -6d.  That should shift it back 6 days from the default. 

So Sunday of this week, -6 days would be Monday of last week using the startOfWeek function.  And using the endOfWeek function, Saturday of this week minus 6 days would be Sunday of last week.  

My apologies for the confusion on the first response.  

Best, 

Andy

Pablo Chacín Martínez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 20, 2022

Thanks for the answer. Just wondering, why instead of proposing this kind of hack don't you make this ISO compliant? Maybe by introducing other functions such as startOfWeekIso. 

Like 이종혁/본부장 likes this
Andy Rusnak
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 20, 2022

Hi Pablo, 

No problem, happy to provide the answer here! 

In terms of your question, this isn't a workaround solution or a hack, the design of this function is to provide the maximum amount of flexibility when using these JQL functions.  While it would be possible to create multiple startOfWeek and endOfWeek functions with different default dates, that would lead to a lot of different function name that could be used within JQL leading to potential confusion on which ones to use at what times.  

The design allowing the configurability using the modifiers as a mentioned allows for a single function to be used (which is easier to remember when writing statements) while allowing maximum customization.  Some teams may start their weeks on Tuesday or Wednesday for example, this allows for that without having to create individualized functions for each potential start of week or end of week. 

If you would like to have the default Sunday - Saturday dates to be re-aligned to Monday - Sunday, you can submit a Suggestion to our Product team.  If there is a lot of user interest in make this shift it may be something our Product team is able to implement in a future release Jira.

Does that help to clarify why the functionality is currently designed the way it is?  If not I would be happy to discuss further.    

Best, 

Andy

Andrew Kopp
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 9, 2023

Even the proposed solution doesnt work for the purpose of reporting.

 

Looking to get a view of last weeks tickets - Monday to Sunday - is impossible using startofWeek and endOfWeek in a dashboard view- as I would now need to amend this each day to ensure it pulls the right data.

 

It is insane to me, how this is a problem. ISO standards exist for a reason.

Like # people like this
Timmo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 20, 2025

I too am astonished that Sunday is the "default" value (implying it can be altered from its default), and yet it cannot be altered?  There's a better word for when something has a value and it cannot be changed: "hard coded".

The proposed solution is very particular to the problem as stated, but really, this issue pervades the entire UI; calendar pickers etc.

Just curious, how is the start of week determined?  From locale, or simply hard-coded?

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events