Weekend Automation being sent out too early?
Asked by Ken Obsequio:

Hello!

I have setup an automation to let customers know that because their ticket was submitted during off hours(weekends), they will have limited support.

The automation is only supposed to go off:

* Friday - After 6PM
* Saturday - All Day
* Sunday - Before 4PM

But for some reason, the automation is going being kicked off early morning on Fridays.

I think it may have to do with request type? or just an error in syntax?

I've attached a copy of my automation block for review:

![SCR-20240913-myus.png](https://community.atlassian.com/t5/image/serverpage/image-id/347385i28B37522EB87B494/image-size/large?v=v2&px=999 "SCR-20240913-myus.png")

Previously I used ".shortTime" to write out the condition. And now Im using the ".longTime"

Any feedback will be helpful !

Thanks in advance


Answers:
author: Natalya Ozhigova
body: Hi [@Ken Obsequio](/t5/user/viewprofilepage/user-id/5426537)

You can use other type of the condition:

![Capture1.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/347498i2D777495A5D1CEB8/image-size/large?v=v2&px=999 "Capture1.PNG")

BR,

Natalya

comments: author: Ken Obsequio
body: Thank you Natalya!  

Is there any way to do this for Every Friday?


author: Robert DaSilva - Adaptavist
body: Hey [@Ken Obsequio](/t5/user/viewprofilepage/user-id/5426537) , the condition that [@Natalya Ozhigova](/t5/user/viewprofilepage/user-id/4460643) shared would be in addition to the IF / ELSE block you are already using.

While the attached screenshot below is not properly filled out based on your specific needs, the structure of the blocks should be what you're looking for.

Essentially, you would need to replace your second "Smart Values" condition with the one [@Natalya Ozhigova](/t5/user/viewprofilepage/user-id/4460643) shared.

![Screenshot 2024-09-18 at 6.38.23?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/348027i96FDC406D9300E3D/image-size/large?v=v2&px=999 "Screenshot 2024-09-18 at 6.38.23?PM.png")


author: Natalya Ozhigova
body: Hi [@Ken Obsequio](/t5/user/viewprofilepage/user-id/5426537)

Thank you [@Robert DaSilva - Adaptavist](/t5/user/viewprofilepage/user-id/3984541) for explanation.  
That's what I meant.


author: Robert DaSilva - Adaptavist
body: Hi [@Ken Obsequio](/t5/user/viewprofilepage/user-id/5426537)

I have a feeling the issue is related to how Jira is comparing the two values. If I were to guess, I can imagine the "Greater Than" condition might be expecting a plain number, and the PM PST component is throwing the comparison logic for a loop.

I would suggest using the .format feature of the time related Smart Values, as found here <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-format---> and formatting the time to be one long number.

This is the test I did:

```
{{created.convertToTimeZone("America/Los_Angeles").format("kkmmss")}}
```

This will result in the time being formatted as the hour between 01 and 24, the minutes from 00 to 59, and the seconds from 00 to 59. So, for 5:51 PM, this would return 175132. You can then use this as a plain number to compare to 6:00 pm, which would be 180000. If the number is larger, then you know it's past that time.

Let me know if this helps!


Tags: cloud

jira-service-management

jira-service-management-cloud