Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AwsDataApi] Handle timestamp #1316

Closed
wants to merge 1 commit into from
Closed

Conversation

kyen99
Copy link

@kyen99 kyen99 commented Sep 28, 2023

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.

Copy link

@acceletron acceletron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this timestamp just does not work. can we get this pull request approved please

@floriangosse
Copy link

floriangosse commented Oct 31, 2023

I've the same problem in my project.

For now I've used patch-package to get around this problem by applying the changes from this PR.

@royscheeren
Copy link

Same issue here, any word on this?

@cshamrick
Copy link

I too have this issue.

@danclaroni
Copy link

me too

@kyen99
Copy link
Author

kyen99 commented Jan 2, 2024

I'm closing this PR since it looks like date handling was fixed in 0.29.2.

@kyen99 kyen99 closed this Jan 2, 2024
@kyen99 kyen99 deleted the aws-fix branch January 2, 2024 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants