nicholaschiang
08/02/2021, 7:14 PMDate objects stored as timestamptz in Supabase turned back into Date objects when queried?
It seems like they're always going to be ISO strings (JSON-ified by Postgrest). Is that correct? That seems like a bad API surface for your SDK IMO...burggraf
08/02/2021, 7:19 PMDate objects stored as timestamptz in Supabase turned back into Date objects when queried?
It seems like they're always going to be ISO strings (JSON-ified by Postgrest). Is that correct? That seems like a bad API surface for your SDK IMO...burggraf
08/02/2021, 7:19 PMnicholaschiang
08/02/2021, 7:20 PMnicholaschiang
08/02/2021, 7:20 PMnicholaschiang
08/02/2021, 7:21 PMsupabase-js SDK could figure that out and wrap those ISO strings with JS Date objects at runtime.burggraf
08/02/2021, 7:21 PM+new Date(), so everything is a unix timestamp. But now I'm moving back to date fields since I'm back in PostgreSQLnicholaschiang
08/02/2021, 7:21 PMnicholaschiang
08/02/2021, 7:21 PM+new Date()?burggraf
08/02/2021, 7:22 PM+new Date() in Javascript, you get the current unix timestamp, which is just a long, which is what I store in my data.nicholaschiang
08/02/2021, 7:22 PMnicholaschiang
08/02/2021, 7:22 PMburggraf
08/02/2021, 7:22 PMburggraf
08/02/2021, 7:23 PMnicholaschiang
08/02/2021, 7:23 PMnicholaschiang
08/02/2021, 7:23 PMburggraf
08/02/2021, 7:23 PMDate object from the data?nicholaschiang
08/02/2021, 7:23 PMnicholaschiang
08/02/2021, 7:23 PMnicholaschiang
08/02/2021, 7:23 PMDate objects herenicholaschiang
08/02/2021, 7:23 PMburggraf
08/02/2021, 7:24 PM.select()?nicholaschiang
08/02/2021, 7:24 PMpgsql
create type timeslot (
from timestamptz,
to timestamptz
);
create table meeting (
time timeslot not null
);nicholaschiang
08/02/2021, 7:24 PMstring for the time.from and time.to propertiesburggraf
08/02/2021, 7:25 PMdate objects?nicholaschiang
08/02/2021, 7:25 PMnicholaschiang
08/02/2021, 7:25 PMnicholaschiang
08/02/2021, 7:26 PMtimestamptz types in postgresqlburggraf
08/02/2021, 7:26 PMnicholaschiang
08/02/2021, 7:26 PMsupabase/postgrest-js repo right?burggraf
08/02/2021, 7:26 PMtimestamptz return a Date?burggraf
08/02/2021, 7:26 PMnicholaschiang
08/02/2021, 7:27 PMtimeslot type?nicholaschiang
08/02/2021, 7:27 PMtimestamptz col?nicholaschiang
08/02/2021, 7:27 PMburggraf
08/02/2021, 7:27 PMtimeslot returns a string?nicholaschiang
08/02/2021, 7:27 PMtimeslot is an objnicholaschiang
08/02/2021, 7:27 PMfrom and to props that are stringsnicholaschiang
08/02/2021, 7:27 PMburggraf
08/02/2021, 7:28 PMtimestamptz returns a Date object but timeslot returns `String`snicholaschiang
08/02/2021, 7:28 PMburggraf
08/02/2021, 7:28 PMnicholaschiang
08/02/2021, 7:28 PMnicholaschiang
08/02/2021, 7:28 PMburggraf
08/02/2021, 7:28 PMnicholaschiang
08/02/2021, 7:29 PMtimestamptz fields are returned as strings by the supabase js clientnicholaschiang
08/02/2021, 7:29 PMburggraf
08/02/2021, 7:30 PMtimestamptz is returned as a string, then it's consistent that timeslot return a string too.nicholaschiang
08/02/2021, 7:31 PMnicholaschiang
08/02/2021, 7:31 PMburggraf
08/02/2021, 7:31 PMPostgrest expert so I'll leave it for them to debate.nicholaschiang
08/02/2021, 7:31 PMDate objects in timestamptz fields instead of ISO stringsnicholaschiang
08/02/2021, 7:31 PMburggraf
08/02/2021, 7:32 PMnicholaschiang
08/02/2021, 7:33 PMnicholaschiang
08/02/2021, 7:33 PMnicholaschiang
08/02/2021, 7:33 PMTimestamp object)nicholaschiang
08/02/2021, 7:38 PMburggraf
08/03/2021, 3:39 AMPostgrest returns JSON, and JSON doesn't have DATE objects.