Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sqlite/lib/SQLiteService.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class SQLiteService extends SQLService {
...super.InputConverters,
// The following allows passing in ISO strings with non-zulu
// timezones and converts them into zulu dates and times
Date: e => e === '?' ? e : `strftime('%Y-%m-%d',${e})`,
Date: e => `strftime('%Y-%m-%d',${e})`,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would the other InputConverters need the same adjustment?

Time: e => e === '?' ? e : `strftime('%H:%M:%S',${e})`,
// Both, DateTimes and Timestamps are canonicalized to ISO strings with
// ms precision to allow safe comparisons, also to query {val}s in where clauses
Expand Down
10 changes: 10 additions & 0 deletions test/compliance/UPDATE.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ describe('UPDATE', () => {
})
})


test('Date object for Date field', async () => {
const { date } = cds.entities('basic.literals')
await UPDATE(date).with({date: new Date("2025-01-02")})

const result = await SELECT.from(date)
expect(result.length).to.eq(1)
expect(result[0].date).to.be.equal('2025-01-02')
})

describe('where', () => {
test('flat with or on key', async () => {
const insert = await cds.run(
Expand Down
2 changes: 2 additions & 0 deletions test/compliance/resources/db/data/basic.literals-date.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
date;
1970-02-02;