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?
According to the docs, it is a supported function.
https://support.atlassian.com/jira-software-cloud/docs/jql-functions/
Hi @Omar Nabulsi ,
You're trying to use startOfWeek()
inside a Structure formula — not in a JQL filter.
But startOfWeek()
is a JQL function, not a supported function in Structure’s formula language.
now()
and subtract daysStructure 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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.