I have a little technical question about Prismic's Date API. Actually we receive dates such as
"first_publication_date": "2020-09-01T09:39:51+0000",
The Date Time String format sent by Prismic is in The ISO8601 Basic format
The problem is that ECMAScript support the ISO8601 Extended format and not the Basic one therfore some browser like safari consider the basic format as invalid.
Calling new Date('2020-09-01T09:39:51+0000') in Safari throws an exception as an invalid Date while with chrome it works well!
ISO 8601 Extended Format is as follows: YYYY-MM-DDTHH:mm:ss.sssZZ is the time zone offset, specified as āZā (for UTC) or either ā+ā or ā-ā followed by a time expression HH:mm
The difference between the extended notation and the basic notation is just the inclusion of the colon in the timezone offset value.
Nice catch regarding the date format sent by Prismic, indeed it does not comply with ECMAScript standard. This may be a legacy from our REST API originally being used by PHP, .NET, and other technologies.
Nowadays you're right most of our users may use our API through client-side or server-side JavaScript and this unconventional date format might be an issue there. We will consider updating our date format to comply with the extended ISO format ECMAScript wants but we'll also have to consider the potential breaking changes this implies.
Regarding your current issue, I suggest you to convert date in basic format coming from Prismic to extended format using a simple regex: