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(amplify-category-function): specify UTC tz when selecting start time #8053

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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