Dates are tricky for a variety of reasons.

In short, when building a SwiftUI app, you should always use the Date data type when storing a date, a time, or a date and a time, like this:

When defining a database hosted at Supabase be sure to use the timestamptz data type.

Like this:

… and this:

That database table matches the Swift structure shared above.

Here is an example app that shows data that contains a date being created, added to the database table, and then refreshed to show in the app:

You can view the commit history for this app here, or download it to try it out here. Feel free to use or adapt this in your own work.