DaReal
DaReal6mo ago

Weekly and Monthly Cron Jobs

I just want to clarify the schedule parameters for the weekly cron job. I want the cron job to run on the Monday of every week by 12am. How do i go about that? The weekly cron job code snippet in the doc didnt include the day key and value but the monthly includes it. crons.monthly( "Bill customers at ", { hourUTC: 17, // (9:30am Pacific/10:30am Daylight Savings Pacific) minuteUTC: 30, day: 1, }, api.billing.billCustomers ) crons.weekly( "Weekly re-engagement email", { hourUTC: 17, // (9:30am Pacific/10:30am Daylight Savings Pacific) minuteUTC: 30, }, api.emails.send )
1 Reply
erquhart
erquhart6mo ago
It's dayOfWeek - it's all typed so intellisense in your editor helps here Here's the schedule definition from source:
/** @public */
export type Weekly = {
/**
* "monday", "tuesday", etc.
*/
dayOfWeek: DayOfWeek;
/**
* 0-23, hour of day. Remember to convert from your own time zone to UTC.
*/
hourUTC: number;
/**
* 0-59, minute of hour. Remember to convert from your own time zone to UTC.
*/
minuteUTC: number;
};
/** @public */
export type Weekly = {
/**
* "monday", "tuesday", etc.
*/
dayOfWeek: DayOfWeek;
/**
* 0-23, hour of day. Remember to convert from your own time zone to UTC.
*/
hourUTC: number;
/**
* 0-59, minute of hour. Remember to convert from your own time zone to UTC.
*/
minuteUTC: number;
};

Did you find this page helpful?