> How to get year-month-day from JavaScript Date Objects
exports.handler = async (event, context) => {
var res = new Date().toISOString().split('T')[0];
const response = {
statusCode: 200,
body: JSON.stringify(res),
};
return response;
};
> Output
node -r esbuild-register run.ts
{ statusCode: 200, body: '"2022-12-17"' }