Importing a date does not work correctly

Hey there

I keep having a problem when importing json documents when i’m targetting a date or timestamp field.

So when generating import documents I populate timestamp fields with an ISO-8601 formatted date, and importing semes fine. When I open the document, the date works and is visible.

However, when I view an imported entry in the API browser, every single date field is null.

If i open an entry in the editor and don’t actually change the date at all and save the entry, then the date field starts showing up in the API explorer, even though it didn’t actually change.

Now, I’m not sure if this is a general bug that happens, but I’ve now seen it on two different imports into separate prismic repos - also, I’ve only ever tried this on an “is” locale - so this might be a locale issue.

Has anybody else had this problem?

Hello, thank you for reaching out!

If you import an incorrect format for these fields, the name will appear but no value will be entered for the field. Look at the correct formats for each one.

Date: this one has to have the format"YYYY-MM-DD"

"release-date": "2016-09-16"

Timestamp

"event-time": "2016-09-15T22:00:00+00:00"

thanks… i was blind over the field not being a ISO8601 formatted field… just expected it, since this is a json document, and it sort of looked like the correct format.

it would be nice if prismic would let you know or warn when you try to import something which isn’t really valid.

Yes, this is would definitely be something that would be really useful to have. I will tag the @features-team so they can consider this in the feature request tracker. Although this, we don’t have plans to work on this right now, we will let you know here if this changes.