[General] Pass a Date to Vapor

Hi everyone!

I would like to address some question about how to pass a Date data type to Vapor.

This is Error in Postman :

This is the Model :

Any help would be appreciate! :blush:

By default Vapor expects dates to be passed in ISO8601 format. So the quick option is to just use that.

Other options are to override the date format in the decoder or set it as String and transform it manually

YYYY-MM-DD is the canonical ISO8601 date format: https://www.iso.org/iso-8601-date-and-time-format.html, and the OP is most definitely using that…

Sorry I should have been more precise - Swift expects a time as well as a date

1 Like