Hey everyone, I have a webinar event that happens at the first Wednesday of every month. I am looking to see if there is a way Zapier could you could give me the exact date of the first Wednesday of the upcoming month.
Example: If I register for the event today, then I would like zapier to give me the output as 04/01/2023 because that is the First Wednesday of the upcoming month January.
If this doesn’t exist, then I would like to delay until the first Wednesday of every month. It would be great if you guys could let me know if this is possible or not.
Hi
Good question.
You may have to use a custom Code step to determine the next X date.
Hi
Good question.
You may have to use a custom Code step to determine the next X date.
Hi
Good answer.
Do you happen to know what the code would look like or how where and how I can search for such codes
GSearches on the topic usually leads to results of code that can be copied/modified.
Hi
Zapier’s date inputs are extremely robust. In my experience, you can just put something like “first wednesday next month” into a delay step.
cc:
Make sure to keep this limit in mind when using the Delay app:
The maximum time a task can be held for is for one month (31 days).
Since tasks will be queued, the maximum number of tasks in the queue depends on the Time Delayed For (value) value.
For example, if you set the delay to one day, the maximum number of tasks in the queue will be 31.
If a 32nd task is created within that period, it will error on the delay step because the scheduled time it will be released is too far away.
You may have to use 2 Delay steps in the Zap:
Delay until the first of the upcoming month
Then Delay until the first wednesday, but again there’s a chance the first Wednesday is the first of the month.
So the logic can get a bit tricky.
You may have to use 2 Delay steps in the Zap:
Delay until the first of the upcoming month
Then Delay until the first wednesday, but again there’s a chance the first Wednesday is the first of the month.
So the logic can get a bit tricky.
I agree with
Hi
Zapier’s date inputs are extremely robust. In my experience, you can just put something like “first wednesday next month” into a delay step.
What if the person joins on January 1st 2023, Zapier will bring in the date for next month of Wednesdays according to the delay “first wednesday next month”
What do you guys think can be done to solve this problem.
In that instance, yes, code will be your best bet. Try the below
let delay_till;
let days_til_wednesday, nextWednesday, nextMonth, year;
let days = ="Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
let today = new Date(inputData.today)
let day_of_week = today.getDay();
let day_of_month = today.getDate();
if (day_of_week === 3 && day_of_month <= 7) {
//today is the first wednesday of the month
delay_till = today;
} else if (day_of_week < 3 && day_of_month <= 7) {
//this might be the next upcoming wednesday if the next wednesday is not the 8th.
//calculate days until wednesday and set tentative release date
days_til_wednesday = 3 - day_of_week;
nextWednesday = new Date(today)
nextWednesday = new Date(nextWednesday.setDate(nextWednesday.getDate() + days_til_wednesday));
delay_till = nextWednesday;
if (nextWednesday.getDate() === 8) {
//this is not the first wednesday of this month. delay until first wednesday of next month.
nextMonth = today.getMonth() + 2;
year = today.getFullYear()
if (nextMonth == 13) {
//next month is january of next year.
nextMonth = 1;
year = today.getFullYear() + 1
}
let firstOfMonth = new Date(`${nextMonth}/1/${year}`)
let firstOfMonth_dow = firstOfMonth.getDay();
if (firstOfMonth_dow === 3) {
//first of next month is wednesday
delay_till = firstOfMonth;
} else if (firstOfMonth_dow < 3) {
//first of next month is before wednesday
days_til_wednesday = 3 - firstOfMonth_dow;
nextWednesday = new Date(firstOfMonth)
nextWednesday = new Date(nextWednesday.setDate(nextWednesday.getDate() + days_til_wednesday));
delay_till = nextWednesday;
} else {
//first of next month is after a wednesday
days_til_wednesday = 10 - firstOfMonth_dow;
nextWednesday = new Date(firstOfMonth)
nextWednesday = new Date(nextWednesday.setDate(nextWednesday.getDate() + days_til_wednesday));
delay_till = nextWednesday;
}
}
} else {
//we have already past the first wednesday
//this is not the first wednesday of this month. delay until first wednesday of next month.
nextMonth = today.getMonth() + 2;
year = today.getFullYear()
if (nextMonth == 13) {
//next month is january of next year.
nextMonth = 1;
year = today.getFullYear() + 1
}
let firstOfMonth = new Date(`${nextMonth}/1/${year}`)
let firstOfMonth_dow = firstOfMonth.getDay();
if (firstOfMonth_dow === 3) {
//first of next month is wednesday
delay_till = firstOfMonth;
} else if (firstOfMonth_dow < 3) {
//first of next month is before wednesday
days_til_wednesday = 3 - firstOfMonth_dow;
nextWednesday = new Date(firstOfMonth)
nextWednesday = new Date(nextWednesday.setDate(nextWednesday.getDate() + days_til_wednesday));
delay_till = nextWednesday;
} else {
//first of next month is after a wednesday
days_til_wednesday = 10 - firstOfMonth_dow;
nextWednesday = new Date(firstOfMonth)
nextWednesday = new Date(nextWednesday.setDate(nextWednesday.getDate() + days_til_wednesday));
delay_till = nextWednesday;
}
}
return { today: today.toDateString(), day_of_week: daysyday_of_week], day_of_month: day_of_month, delay_till: delay_till.toDateString() }
As a troy mentioned there may be some rare scenarios where Zapier has to delay longer than is allowed. To be safe, you can break your Zap into multiple zaps and use Airtable for longer delays.
The above related article references using either Google Calendar or Airtable to create delays longer than 30 days. Airtable is my preferred method since with Google Calendar you may have to scrape information out of the event details or something but with Airtable you can create individual fields for information you might need when Zapier triggers again.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.