postgrest-js icon indicating copy to clipboard operation
postgrest-js copied to clipboard

Allow parsing date and time types as JS `Date`

Open soedirgo opened this issue 1 year ago • 1 comments

PostgREST returns date & time types as a JSON string (and will continue to do so, since there's no native date/time type in JSON).

However, we can modify the JSON parsing such that date & time columns are returned as JS Date for ease of use.

This will require changes in:

  • the generated types, since we need to know which columns have a date/time type - currently they're generated as string which is indistinguishable from e.g. text columns
  • this client library, since we need to actually transform these columns to Date during JSON parsing

Requested in:

  • https://github.com/supabase/postgrest-js/pull/233
  • https://github.com/supabase/supabase-js/issues/1267
  • https://github.com/supabase/postgres-meta/issues/822

soedirgo avatar Nov 05 '24 08:11 soedirgo