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

Missing DateTime to Date conversion during UPDATE with SQLite #1002

Open
stockbal opened this issue Jan 29, 2025 · 0 comments
Open

Missing DateTime to Date conversion during UPDATE with SQLite #1002

stockbal opened this issue Jan 29, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@stockbal
Copy link

Description of erroneous behaviour

I have the following CAP db model

entity Calculations : cuid, managed {
    calculatedOn : Date;
}

In my TypeScript Code I want to run the following UPDATE query

await UPDATE(Calculations, id).set({ calculatedOn: new Date() })

The update query is executed without issues, but afterwards, a SELECT on the updated row shows the following output

{
  "ID": "382fee26-370d-40d2-bd58-49faedc76faf",
  "calculatedOn": "2025-01-29T08:56:53.117Z"
}

instead of

{
  "ID": "382fee26-370d-40d2-bd58-49faedc76faf",
  "calculatedOn": "2025-01-29"
}

With @cap-js/sqlite and version <= 1.7.4 this automatic conversion still works. The behavior changed in 338e9f5. As the current implementation of @cap-js/hana still performs the conversion/cut-off during UPDATE I would expect the SQlite driver to behave the same way.

Detailed steps to reproduce

For example (→ replace by appropriate ones for your case):

  1. git clone https://github.com/stockbal/sqlite-issue-test
  2. npm ci
  3. npm run watch

Details about your project

Project https://github.com/stockbal/sqlite-issue-test
OData version v4
Node.js version v20.18.1
@sap/cds 8.7.0
@sap/cds-compiler 5.7.0
@sap/cds-dk 8.7.0
@cap-js/sqlite 1.7.8
@stockbal stockbal added the bug Something isn't working label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant