Forums

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

Why is startOfWeek() not recognized in Jira structure formula?

Omar Nabulsi April 11, 2025

I'm simply trying to make a structure formula that checks for worklogs in current week. 

It is a very simple formula, but Jira keeps saying it does not recognize startOfWeek().

Can someone please tell me what I am missing?

Screenshot 2025-04-12 at 12.43.56 AM.png

According to the docs, it is a supported function. 

https://support.atlassian.com/jira-software-cloud/docs/jql-functions/

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
4 votes
Answer accepted
Sanam Malleswari
Community Champion
April 12, 2025

Hi  @Omar Nabulsi ,

You're trying to use startOfWeek() inside a Structure formulanot in a JQL filter.

But startOfWeek() is a JQL function, not a supported function in Structure’s formula language.

Use now() and subtract days

Structure does support NOW() — so you can get the current date/time and subtract a few days to approximate the start of the week.

worklog.FILTER($.startDate >= NOW() - 7*24*60*60*1000).timeSpent / 3600000

  • This filters worklogs from the past 7 days (a rough “this week” filter)

  • NOW() gives current timestamp

  • Multiply 7 days × 24 hours × 60 minutes × 60 seconds × 1000 ms

    Note: Not perfect for Monday-to-now filtering, but close.

Formulas

 

Omar Nabulsi April 12, 2025

Hey @Sanam Malleswari , thank you so much for your detailed answer.  That is really helpful.  Do you know if it is possible to construct a formula that updates dynamically?

In other words, on Monday it would be NOW() - 0, on Tuesday it would be NOW() - 1, etc?

Sanam Malleswari
Community Champion
April 12, 2025

Yes, try below formulas:

NOW() - (WEEKDAY(NOW()) - 1) * 86400000

  • NOW() = current timestamp

  • WEEKDAY(NOW()) = number of the day (Monday = 1, Sunday = 7)

  • Subtract WEEKDAY - 1 to get how many full days have passed since Monday

  • Multiply that by 86400000 (milliseconds in a day)

  • That gives you Monday of the current week at this time



If you want it to reset to start of each day, use something like:
startOfDay(NOW() - (WEEKDAY(NOW()) - 1) * 86400000)


 

Like # people like this
Omar Nabulsi April 12, 2025

Thank you so much @Sanam Malleswari !  It works perfectly.  Really appreciate your help.

DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events