Create Calendar Event API JSON String Requirement

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: Calendar - Expo Documentation

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:

Hi @cjaredm! That API expects a Date object: Date - JavaScript | MDN

1 Like

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!

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