fix(datasource-sequelize): serialize Dateonly fields as YYYY-MM-DD format#1442
Conversation
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (2)
🛟 Help
|
16d7a06 to
2eda6d3
Compare
0a5cb5a to
5cde0df
Compare
…rmat Dateonly fields in composite primary keys were being serialized with the full ISO timestamp (2025-01-15T00:00:00.000Z) instead of just the date (2025-01-15), causing detail page lookups to fail. The serializer now checks the field type and formats Dateonly fields correctly. Fixes #1441 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
5cde0df to
47c8f7c
Compare
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| if (value instanceof Date) { | ||
| const typeKey = (rawAttributes?.[name]?.type as { key?: string })?.key; | ||
| const iso = this.serializeDate(value); | ||
| record[name] = typeKey === DataTypes.DATEONLY.key && iso ? iso.slice(0, 10) : iso; |
There was a problem hiding this comment.
here iso will be the result of serializeDate compared to before it was serializeValue.
What is the difference between both ?
There was a problem hiding this comment.
Code should be refactored, but in our case we can call directly the serializeDate method :)
|
linked to this issue: #1441 |
## @forestadmin/datasource-sequelize [1.13.2](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/datasource-sequelize@1.13.1...@forestadmin/datasource-sequelize@1.13.2) (2026-02-03) ### Bug Fixes * **datasource-sequelize:** serialize Dateonly fields as YYYY-MM-DD format ([#1442](#1442)) ([db7b967](db7b967)), closes [#1441](#1441)

Summary
Dateonlyfields to useYYYY-MM-DDformat instead of full ISO timestampDATEONLYfields caused detail page lookups to failProblem
When a
DATEONLYfield is part of a composite primary key, the ID was being generated incorrectly:1|group-123|2025-01-15T00:00:00.000Z1|group-123|2025-01-15Solution
The
Serializerclass now checks the field type from the model'srawAttributesand formatsDateonlyfields asYYYY-MM-DD.Test plan
Dateonlyfield serializationDatefield serialization (unchanged behavior)Date/DateonlyfieldsFixes #1441
🤖 Generated with Claude Code