Как добавить текущую дату в putItem в VTL
{
"version": "2017-02-28",
"operation": "PutItem",
"key": {
"id": $util.dynamodb.toDynamoDBJson($util.autoId()),
"createdDate":$core_v2_utility.CurrentDate
},
"attributeValues": $util.dynamodb.toMapValuesJson($ctx.args.input),
"condition": {
"expression": "attribute_not_exists(#id)",
"expressionNames": {
"#id": "id",
"#createdDate":"createdDate",
},
},
}
Я пытался добавить createDate в DynamoDB с использованием VTL. Я нахожу ошибку с $core_v2_utility.CurrentDate
1 ответ
AWS AppSync не имеет $core_v2_utility.CurrentDate
, Вы хотели использовать одного из помощников? $util.time.nowFormatted("yyyy-MM-dd HH:mm:ssZ")
дает вам текущую дату и время в UTC.