IST time in AWS appsync pipeline resolver function

0

I have a pipeline resolver which should automatically fetch the current IST date time from $util.time in aws appsync,

$util.time.nowISO8601() returns the UTC time, It works perfectly but then i should setup time conversion on my app frontend

I get an error when trying $util.time.nowFormatted("yyyy-MM-dd HH:mm:ssZ", "Asia/Kolkatta") "message": "Cannot return null for non-nullable type: 'AWSDateTime' within parent

已提問 2 年前檢視次數 468 次
1 個回答
1
已接受的答案

I believe the root cause is a typo in ZoneId. According to utility documentation formats is based on DateTimeFormatter which uses TZDB IDs for TimeZones. According to this it should be either Asia/Calcutta or Asia/Kolkata. You can find a helpful list of time zones here

AWS
wolanlu
已回答 2 年前
profile picture
專家
已審閱 1 個月前
  • Thanks for the answer, but I get following error.

    can't serialize value (/createpayInfo/date) : Unable to serialize 2022-03-28 12:34:59+0530 as a valid DateTime Object.

    Changing the type from AWSDateTime to String fixed the issue. Seems other time zone value is not accepted when value is inserted in dynamodb.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南