Check is time is between range of time - Jira autoamtion

Tal Sabag June 2, 2023

Hello everyone,

 

I was trying for few hours without any success.
I have a date field, which I convert to time zone and format to short date.

{{issue.customfield_11123.convertToTimeZone("Asia/Jerusalem").shortTime}}

If want to create the following condition and actions:

1. if the time is between or equal to 00:00 AM  - 06:00 AM
then I want to reduce 1 day from the customfield_11123 date and set the time to 05:00 AM

for example if my customfield_11123 is 02/06/2023 03:00 AM, then I want to get this output: 01/06/2023 05:00 AM

2. then the opposite condition, if the time is not between 00:00 AM  - 06:00 AM
then I want to change the time value of customfield_11123 and set the time to 05:00 AM

for example if my customfield_11123 is 02/06/2023 10:00 AM, then I want to get this output: 02/06/2023 05:00 AM

anyone have a good way to go it using jira automation / smart values ?

 

 

 

1 answer

1 accepted

3 votes
Answer accepted
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 2, 2023

Hi @Tal Sabag 

You would use If/Else with advanced condition:

{{issue.customfield_11123.convertToTimeZone("Asia/Jerusalem").format("H")}}
Less Then
6

This will look at the field and determine if it is before 6:00 AM Asia/Jerusalem time

Then you would add an Edit Issue action to change the date accordingly:

{{issue.customfield_11123.minusDays(1).withHour(5).withMinute(0)}}

Your Else condition would be something like this:

{{issue.customfield_11123.withHour(5).withMinute(0)}}

I haven't tested so it may require a little bit of play.  I'd recommend running tests with these strings writing to the log so you can tease it out.

Tal Sabag June 2, 2023

Amazing !!

Works, thanks a lot !

Have a great day 

Like Mark Segall likes this

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