Forums

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

Determine if the current hour falls between two values from lookup tables

Richard A_ Michaels
Contributor
March 18, 2025

I have two lookup tables, one defines the start hour and the other defines the end hour.

I need to create a variable which will either be true or false based on whether the current hour is within the range.  I've tried the following smart value but Jira can't render the value

Based on the value of the variable, another value will be set to true or false.

Here's the smart value formula I'm trying to get to work.

{{and(now.convertToTimeZone("America/New_York").hour.gt(tblStartHour.get( varKey),now.convertToTimeZone("America/New_York").hour.lt(tblEndHour.get(varKey))}}

Has anyone done such a smart value calculation or have ideas to accomplish this.

1 answer

1 accepted

0 votes
Answer accepted
Trudy Claspill
Community Champion
March 18, 2025

Hello @Richard A_ Michaels 

I recommend that you use the Log action to log the values within the smart value piece by piece to verify you are getting the hours you expect. For instance in a Log action log

{{now.convertToTimeZone("America/New_York")}}

Then in the next Log action log

{{now.convertToTimeZone("America/New_York").hour}}

Then

{{varKey}}

{{tblStartHour.get( varKey)}}

{{tblEndHour.get(varKey)}}

 

One problem that I suspect this may identify is that I believe this is not valid syntax:

{{now.convertToTimeZone("America/New_York").hour}}

...since hour is not one of the format key words listed here:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

To extract the just the hour from the results on convertToTimeZone you would need to use the format command with a valid input as described here:

Screenshot 2025-03-18 at 10.27.51 PM.png

I think what you will need to use is one of these

now.convertToTimeZone("America/New_York").format("h") - to get the hour as 1-12

now.convertToTimeZone("America/New_York").format("k") - to get the hour as 1-24

 

Richard A_ Michaels
Contributor
March 19, 2025

Hi Trudy,

Thanks for your reply. 

This smart value, {{now.convertToTimeZone("America/New_York").hour}}, worked as expected.  The issue was more centered around the fact that I needed to determine whether the current hours was between two values which are extracted from the tables.  

I resolved my issue outside of Jira automation, which means Jira automation will be doing much less of the actual processing. 

Thanks,

Richard

Trudy Claspill
Community Champion
March 19, 2025

Hello Richard,

I'm glad you found a solution.

Can you share the details, for the benefit of other folks who have a similar need and find your post?

Richard A_ Michaels
Contributor
April 4, 2025

Trudy,

I moved all the functionality to Zapier.  Jira automation just send specific information to Zapier and Zapier calls an incoming webhook with the issue key and result

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