Skip to content

Commit

Permalink
fix(amplify-category-function): specify UTC tz when selecting start t…
Browse files Browse the repository at this point in the history
…ime (#8053)
  • Loading branch information
danielleadams authored Sep 9, 2021
1 parent 13abcf4 commit 5e3d69a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,13 @@ export async function timeHelper(exp: CronBuilder) {
const timeQuestion = {
type: 'datetime',
name: 'dt',
message: 'Select the start time (use arrow keys):',
message: 'Select the start time in UTC (use arrow keys):',
format: ['hh', ':', 'mm', ' ', 'A'],
};

const timeAnswer = await inquirer.prompt([timeQuestion]);
exp.set(
'minute',
(<dtType>timeAnswer.dt)
.getMinutes()
.toString()
.split(),
);
exp.set(
'hour',
(<dtType>timeAnswer.dt)
.getHours()
.toString()
.split(),
);
exp.set('minute', (<dtType>timeAnswer.dt).getMinutes().toString().split());
exp.set('hour', (<dtType>timeAnswer.dt).getHours().toString().split());
return exp;
}

Expand Down Expand Up @@ -98,13 +86,7 @@ export async function monthHelper(exp, context) {
const suffix = (<dtType>dateAnswer.dt).getDate() === 31 ? 'st' : 'th';
context.print.warning(`Function won't be invoked on months without the ${(<dtType>dateAnswer.dt).getDate()}${suffix} day`);
}
exp.set(
'dayOfTheMonth',
(<dtType>dateAnswer.dt)
.getDate()
.toString()
.split(),
);
exp.set('dayOfTheMonth', (<dtType>dateAnswer.dt).getDate().toString().split());
return exp;
}

Expand All @@ -120,19 +102,7 @@ export async function yearHelper(exp, context) {
const suffix = (<dtType>dateAnswer.dt).getDate() === 31 ? 'st' : 'th';
context.print.warning(`Function won't be invoked on months without the ${(<dtType>dateAnswer.dt).getDate()}${suffix} day`);
}
exp.set(
'dayOfTheMonth',
(<dtType>dateAnswer.dt)
.getDate()
.toString()
.split(),
);
exp.set(
'month',
(<dtType>dateAnswer.dt)
.getMonth()
.toString()
.split(),
);
exp.set('dayOfTheMonth', (<dtType>dateAnswer.dt).getDate().toString().split());
exp.set('month', (<dtType>dateAnswer.dt).getMonth().toString().split());
return exp;
}
6 changes: 3 additions & 3 deletions packages/amplify-e2e-core/src/categories/lambda-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const coreFunction = (
}
} else {
if (settings.layerOptions && settings.layerOptions.layerAndFunctionExist) {
chain.wait('Select which capability you want to update:').sendCarriageReturn() // lambda function
chain.wait('Select which capability you want to update:').sendCarriageReturn(); // lambda function
}
chain.wait('Select the Lambda function you want to update').sendCarriageReturn(); // assumes only one function configured in the project
}
Expand Down Expand Up @@ -494,7 +494,7 @@ const addWeekly = (chain: ExecutionContext) => {
chain
.wait('Select the day to invoke the function:')
.sendCarriageReturn()
.wait('Select the start time (use arrow keys):')
.wait('Select the start time in UTC (use arrow keys):')
.sendCarriageReturn();
return chain;
};
Expand All @@ -520,7 +520,7 @@ const addCron = (chain: ExecutionContext, settings: any) => {
addhourly(moveDown(chain, 1).sendCarriageReturn());
break;
case 'Daily':
moveDown(chain, 2).sendCarriageReturn().wait('Select the start time (use arrow keys):').sendCarriageReturn();
moveDown(chain, 2).sendCarriageReturn().wait('Select the start time in UTC (use arrow keys):').sendCarriageReturn();
break;
case 'Weekly':
addWeekly(moveDown(chain, 3).sendCarriageReturn());
Expand Down

0 comments on commit 5e3d69a

Please sign in to comment.