Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Schedule Trigger Node): Default to 0 minute if falsy on hourly run #9146

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions packages/nodes-base/nodes/Schedule/ScheduleTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ScheduleTrigger implements INodeType {
name: 'scheduleTrigger',
icon: 'fa:clock',
group: ['trigger', 'schedule'],
version: [1, 1.1],
version: [1, 1.1, 1.2],
description: 'Triggers the workflow on a given schedule',
eventTriggerDescription: '',
activationMessage:
Expand Down Expand Up @@ -415,7 +415,7 @@ export class ScheduleTrigger implements INodeType {
const rule = this.getNodeParameter('rule', []) as IDataObject;
const interval = rule.interval as IDataObject[];
const timezone = this.getTimezone();
const version = this.getNode().typeVersion;
const nodeVersion = this.getNode().typeVersion;
const cronJobs: CronJob[] = [];
const intervalArr: NodeJS.Timeout[] = [];
const staticData = this.getWorkflowStaticData('node') as {
Expand Down Expand Up @@ -451,7 +451,7 @@ export class ScheduleTrigger implements INodeType {
for (let i = 0; i < interval.length; i++) {
let intervalValue = 1000;
if (interval[i].field === 'cronExpression') {
if (version > 1) {
if (nodeVersion > 1) {
// ! Remove this part if we use a cron library that follows unix cron expression
convertToUnixFormat(interval[i]);
}
Expand Down Expand Up @@ -494,7 +494,10 @@ export class ScheduleTrigger implements INodeType {

if (interval[i].field === 'hours') {
const hour = interval[i].hoursInterval as number;
const minute = interval[i].triggerAtMinute?.toString() as string;
let minute = interval[i].triggerAtMinute?.toString() as string;
if (!minute && nodeVersion >= 1.2) {
elsmr marked this conversation as resolved.
Show resolved Hide resolved
minute = '0';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the same issue exist in a lot of other places in the Schedule node? You can delete any number field, and we don't set a fallback

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, will push update

}
const cronTimes: string[] = [minute, '*', '*', '*', '*'];
const cronExpression: string = cronTimes.join(' ');
if (hour === 1) {
Expand Down