Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
marciocadev committed Jul 19, 2023
1 parent a98c3e1 commit 9a5bef3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions libs/wingsdk/src/target-awscdk/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ export class Schedule extends cloud.Schedule {
let cronOpt: { [k: string]: string } = {
minute: cronArr[0],
hour: cronArr[1],
day: cronArr[2],
month: cronArr[3],
weekDay: cronArr[4],
year: "*",
};
if (cronArr[2] !== "?") {
cronOpt.day = cronArr[2];
}
if (cronArr[4] !== "?") {
cronOpt.weekDay = cronArr[4];
}

this.scheduleExpression = EventSchedule.cron(cronOpt);
} else {
Expand Down
2 changes: 1 addition & 1 deletion libs/wingsdk/test/target-awscdk/schedule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,4 @@ test("cron with Day-of-month and Day-of-week setting with *", () => {
).toThrow(
"cannot use * in both the Day-of-month and Day-of-week fields. If you use it in one, you must use ? in the other"
);
});
});

0 comments on commit 9a5bef3

Please sign in to comment.