I’m looking to create a zap that runs at the end of each month (say, the 24th) and creates 6 notion database entries. These database entries need a date entry (so it works as a calendar). These 6 dates need to be non-weekend and non-holiday days.
I’ve managed to work out how to essentially do this:
- trigger scheduler for the 24th of every month
- create notion event titled Day 1
- create notion event titled Day 2
- create notion event titled Day 3
- create notion event titled Day 4
- create notion event titled Day 5
- create notion event titled Day 6
- format the date from step 1 as YYYY-MM-01 (so that it is the FIRST day of the month)
- format that date as ddd
- format the date as YYYY
- use a holiday list API that pulls the year from step 4 to create a list of days that are federal holidays as YYYY-MM-DD
- Weekend or Holiday?
- if date contains Sun or Mon (from step 9) or is contained in holiday list (from step 11)
- format date from step 8 as YYYY-MM-DD +1 day
- RERUN step 12, essentially keep adding days until its neither a holiday or weekend.
- if date does not contain Sun and Mon (from step 3) and is not contained in holiday list (from step 5)
- change notion event “Day 1” to have this date
- take this date +1 day and RERUN step 12 until it hits 6 notion entries
- if date contains Sun or Mon (from step 9) or is contained in holiday list (from step 11)
And this is about where it gets fuzzy. I’m sure there’s a way to loop this or sub-zap, but I’m pulling my hair out here. I know I need it to incrementally go up in both date and notion database entry- so if 10/1 is put into notion entry 1, 10/2 wont overwrite notion entry 1 and instead update notion entry 2.
Any ideas or suggestions would be greatly appreciated.