Forums

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

Using smart values to change monthly date

David Loszewski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 16, 2020

Hi,

I found the following doc on how to use smart values to manipulate and format dates: https://support.atlassian.com/jira-software-cloud/docs/use-smart-values-to-manipulate-and-format-dates/

However, it does not state how to handle monthly dates, for example: the 3rd Thursday of every month.  Is there anything that supports that?  As the number of days change depending on the month. 

2 answers

0 votes
Shannon Wallace
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!
November 22, 2023

I have done similarly with the following: {{now.plusDays(30).ofTheMonth(1, 3)}}. This gives me the first Wednesday of the following month, achieved by now + 30 days, and then "of the month" feature.

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 27, 2020

Hi @David Loszewski 

What problem are you trying to solve? 

For example, are you trying to set up a scheduler for a rule on a cadence such as "the 3rd Thursday of every month"?  If so, please look over the documentation on scheduled triggers and the use of Cron expressions:

https://support.atlassian.com/jira-software-cloud/docs/automation-triggers/

http://www.cronmaker.com/

 

Best regards,

Bill

David Loszewski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2020

Hi @Bill Sheboy ,

Thank you for the response.   I have a date/time field in issues that I want to change.   If I have an issue that has a date of November 13th @ 2PM and happens on the 2nd Friday of every month at the same time, that date field is basically a recurring date field, like you would have in a calendar.  So I'm looking to manipulate the the date so if it's November 13th @ 2PM, I want that to change to December 11th @ 2PM once I call my script.   I'm able to make it change to the 13th of every month or something similar, but I want it to be the 2nd friday of every month.   

Thanks,

Dave

David Loszewski
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2020

I'm hoping there's something like {{now.2ndFridayofMonth}}

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 13, 2020

Interesting problem... This seems to work (and it is convulted  ;^)

Let's say you wanted the 2nd Friday after whatever the current issue's updated date:

{{issue.updated.endOfMonth.withNextDayOfWeek("FRI").plusDays(7)}}

How this works:

  • Take the date you are interested in
  • Go to the end of the month using .endOfMonth
  • Go forward to the first Friday in the new month using .withNextDayOfWeek("FRI")
  • Skip ahead a week to the second Friday using .plusDays(7)

I haven't fully tested this. You get the idea and can experiment a bit to find an algorithm that will work.

Like # people like this

Suggest an answer

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

Atlassian Community Events