sst / kysely-data-api

78 stars 21 forks source link

Query compiler support for Date & typeHint #5

Closed karmux closed 2 years ago

karmux commented 2 years ago

Added Date object and typeHint support to query compiler. Adjust DATE, TIME & TIMESTAMP automatically to accepted format. Configured ESLint.

thdxr commented 2 years ago

I would merge this PR without the eslint addition

thdxr commented 2 years ago

Thanks for the update! Note the import with .js extensions were on purpose for ESM support

steviec commented 2 years ago

Is this going to get merged anytime soon? I'm still having to do gross things with Date string on response to make sure that the Postgres => Javascript transfer isn't borked. For every field that gets returned from the kysely-data-api adaptor I have to run this function since postgres stores date strings without UTC identification so javascript thinks it's dealing with a date in localtime.

function convertPostgresStringToUTCDate(dateString: string) {
  return new Date(dateString + "Z");
}
thdxr commented 2 years ago

I haven't had the time to test this out but I can merge it and let the community tell me if there are any issues

steviec commented 2 years ago

It's easy for me to say "yes", but I wouldn't want to destabilize this library :). I'm happy to npm install this branch instead and do some testing, but the problem is that it doesn't include the newest upstream (e.g. the relaxed peer dependency addition). I'm a little leery of hand changing files locally to test changes like this instead of doing it on an "official" branch that will become the new master.