Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Convert ISO or UTC datetime string to AWS Data API date format
AWS Data API requires a specific date formatting that is different than the ISO or UTC date string. Per this document: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html#:~:text=Certain%20types%2C%20such%20as%20DECIMAL,UUID%20type%20to%20the%20database.
pg-core converts JS Date types using toISOString() or toUTCString() so I believe they will always get to the AWS Data API driver as a string. Converting to a Date and then calling toISOString() before replacing substrings seems like the most reliable way to solve this short of using a date formatting library.
Because pg-core converts timestamps to strings before it gets to this driver, I'm not even sure how the
else if (value instanceof Date)
on line 77 will ever be used.Someone please let me know if there is a better approach to fix this. I could not figure out how to run the awsdatapi tests despite filling in the ENV vars for them. I am not sure how the awsdatapi insert test passes (or if it does) because I can't figure out how to run it to test it. I would gladly write a test case for this if someone can point me in the right direction to run those tests.