Open calvin-cdev opened 2 years ago
opened a pr in the data-api-client repo to fix https://github.com/jeremydaly/data-api-client/pull/117 worth noting that at the request of the author, this pr targets their aws sdk v3 migration branch, not main. so the fix won't be available until they release that version.
Thanks for your contribution! Reading about your findings it looks like the best would be to fix it in the data-api-client. Let's keep this open until the PR is merged so we can upgrade to the fixed data-api-client version when it's released.
Package versions and database engine type (please complete the following information):
Describe the bug When I do an insert for an entity with a generated date (timestamp) field like
createdAt
orupdatedAt
, the value in the resultantgeneratedMaps
is a string, not aDate
. I would expect a Date object, just like I would get in the result of afind
operation, but I end up getting a string. Worse, the string is missing the UTCZ
at the end, so there is even more work to do to get it back to UTC time as a Date object.Not only is the value on the generatedMaps incorrectly formatted, but also the mutated entity object passed into the insert call has the incorrectly formatted date:
I'd be happy to fix this, but I need guidance I'm not sure where the fix should go. It could go into this driver package. It could go into typeorm. It could also go into the data-api-client. I think it should go into the data-api-client, and here is why: There was a PR to address this issue but the relevant part of the fix was dropped by the owner while addressing merge conflicts before merging the PR. From the requester's findings and my own, it looks like aws sends the
typeName
fromexecuteStatement
commands back in lowercase for postgres :grimacing: . The code in the data-api-client is written only to compare against uppercasetypeName
values. I monkey-patched the package and found that this issue was indeed fixed. However, I'm not sure if this is actually the correct layer for the fix. What do you think?To Reproduce
be sure to use
formatOptions.deserializeDate=true
entity class
use it
view that the
result
hasgeneratedMaps
withcreatedAt
as a timezone-less string. It should be a UTC Date.