Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,301,209
Community Members
 
Community Events
165
Community Groups

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

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 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 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

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. 

Andy Rusnak Atlassian Team 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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

229 views 2 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you