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

Prepared statement does not work with dates >= 10000/01/01 #1834

Open
kaciakmaciak opened this issue Aug 31, 2024 · 0 comments
Open

Prepared statement does not work with dates >= 10000/01/01 #1834

kaciakmaciak opened this issue Aug 31, 2024 · 0 comments

Comments

@kaciakmaciak
Copy link

What happens?

In prepared statements, dates (and other data types) are serialised using JSON.stringify. The date values are stringified using Date.prototype.toISOString() fn. See MDN. Everything works fine, as long as the resulting format is YYYY-MM-DDTHH:mm:ss.sssZ or -YYYYYY-MM-DDTHH:mm:ss.sssZ. The things brake when the resulting format is +YYYYYY-MM-DDTHH:mm:ss.sssZ.

To Reproduce

const connection = await duckdbInstance.connect();
const statement = await connection.prepare(`
  SELECT CAST(? AS DATE)
`);
// the following throws
const result = await statement.query(new Date(Date.UTC(10000, 0, 1)));

Please see an example in Codesandbox.

Browser/Environment:

Any

Device:

Any

DuckDB-Wasm Version:

1.28.1-dev242.0

DuckDB-Wasm Deployment:

N/A

Full Name:

Katarina Anton

Affiliation:

Individual

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

No branches or pull requests

1 participant