Create Calendar Event API JSON String Requirement

#1

I’m fairly new to Expo, and React Native.
Trying to create a calendar event and have been able to check status/authorization, request it if I don’t have it, and then try to make the event.
I get an error saying

JSON String ‘2018-07-28 06:30:00’ could not be interpreted as a date.
Expected format: YYYY-MM0DD’T’HH:mm:ss.sssZ.

I have tried several different iterations of the same date, removing a bunch, adding on more, getting the format from moment.js and requesting the format from that. I’ve hard coded the date as a string trying to get it to fit the format but still get the same error.

The Expo Calendar API doc for this is here: https://docs.expo.io/versions/latest/sdk/calendar#expocalendarcreateeventasynccalendarid-details

It just says that startDate is required but not the format, and no examples. I’m sure I’m missing something obvious here with the JSON, but just not experienced enough to figure it out yet. Hope someone can shed some light for me.
Thanks for your help! :grin:

#2

Hi @cjaredm! That API expects a Date object: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

1 Like
#3

Thanks @jesse! I knew it would be something simple. Throw it in a Date(). Duh. Haha.
Now it brings me to my next error about it not saving. Progress!

closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.