System error with createEvent( )

I followed the the steps detailed here: https://www.wix.com/velo/reference/wix-events-backend/wixevents/createevent

I could not create an event using the example; the error just says “System Error occurred”.
However I found that I could create an Event if I removed the scheduling.startDate and scheduling.endDate fields, and used a TBD event instead, with
scheduling.tbd: true
scheduling.tbdMessage: “my test TBD”

On a related note, the example is not correct as you cannot use “USA” in eventInfo.location.country just change to “US” instead.

I have tried many variations on the date format, even using code to set it to the current date, but always get the same error.
Is there any more documentation about this error ?

I found the answer. As the API documentation states, the startDate and endDate fields are of type Date, so the example code is incorrect.

You need to do something like this:

scheduling: {
timeZoneId: “Europe/London”,
startDate: new Date(“2021-09-25T12:00:00Z”),
endDate: new Date(“2021-09-26T12:00:00Z”)
},