How can I check that today's date matches a specific list of dates.
Asked by Nadege:

We have an automation that creates a ticket every weekday. I would like to add a condition to the automation that causes it to skip specific days i.e. tickets are not created for holidays such as Christmas (25/12) or New Year's Day (01/01).

Have tried using smart values but did not manage. Is this possible to do and if so, how can we go about doing this?

Thanks in advanced.


Answers:
author: Jovin
body: Hey [@Nadege](/t5/user/viewprofilepage/user-id/5469930)

Dates can be tricky.... here's my recommendations. I'd go with option 2 personally!

**Option 1: IF/ELSE in Automation rule with hard-coded dates**

try using the condition in your automation of "IF/ELSE" (no need to use the else as you can add all the dates into the conditions of the first IF).

I would configure it like this (for each date):

* {{smart values}} condition
  * First value: {{now.jqlDate}}
  * Condition: does not equal
  * Second value: date in YYYY-mm-dd format (e.g. 2024-12-25)
    * You can make this dynamic for year by setting it like: {{now.year}}-12-25

A screenshot showing this is below:

![smart values.png](https://community.atlassian.com/t5/image/serverpage/image-id/330890i09765E9C15E8DFDC/image-size/large?v=v2&px=999 "smart values.png")

**Option 2: Visual through using multiple projects**

Option 2 allows for some good flexibility by using a proxy project to act as a calendar... it's a funky way but hear me out. Benefits of this is you can easily add or remove dates, AND someone else can manage them without touching your automation!

1. Create a project to act as your "Calendar" (for this I'll use the key "CAL" for the project)
2. Create issues where the Due Date is the date you want your automation to skip
   1. You can import these using the [Jira CSV Import function](https://support.atlassian.com/jira-cloud-administration/docs/import-data-from-a-csv-file/)
3. Setup your automation to look at both projects (the one you want it to create issues in, and the calendar project).
4. Setup your automation like below:
5. Action: Lookup issues
   1. JQL: project = CAL AND duedate = {{now.jqlDate}}
6. Condition: {{smart values}} condition
   1. First value: {{lookupIssues.size}}
   2. Condition: equals
   3. Second value: 0
7. Action: Create your issues that you want

See screenshot of flow below:

![visual flow.png](https://community.atlassian.com/t5/image/serverpage/image-id/330894iF8BFF2E29CCDBA21/image-size/large?v=v2&px=999 "visual flow.png")

comments: author: Nadege
body: Hi [@Jovin](/t5/user/viewprofilepage/user-id/5104734) thanks so much! Will look into which solution is best for us.


author: Jimmyroe
body: You can check if today's date matches a specific list of dates using various methods. In Python, you can use the \`datetime\` module to get today's date and compare it against a predefined list of dates. First, import the module and define your list of dates in a consistent format, such as \`YYYY-MM-DD\`. Then, get today's date using \`datetime.today().strftime('%Y-%m-%d')\`, and check if this date exists in your list using a simple if statement. If today's date is in the list, you can print a message indicating a match; otherwise, print that there is no match. This approach can be easily adapted for other programming languages or tools like Google Sheets or JavaScript, using their respective date handling and comparison functions.


author: Aaron Pavez _ServiceRocket_
body: Hi [@Nadege](/t5/user/viewprofilepage/user-id/5469930)

As [@Jovin](/t5/user/viewprofilepage/user-id/5104734) mentioned, the first option is the best one IMHO. And thanks [@Jovin](/t5/user/viewprofilepage/user-id/5104734) I didn't know you could use this value **{{now.year}}-12-25** like that.

If you want to know more about smart values for dates check here:

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

Regards

comments: author: Jovin
body: Gotta love the smart values [@Aaron Pavez _ServiceRocket_](/t5/user/viewprofilepage/user-id/4482404) ! Can get super creative with them!

The first one is definitely easier to understand, but I do quite like using projects for "visual auditing"... I do the same thing for bulk API calls etc. ?


Tags: cloud

jira-work-management

jira-work-management-cloud