Expected behavior
When clicking a record with a composite primary key that includes a DATEONLY field, the detail page should load correctly.
Actual behavior
The API response includes the timestamp in the composite primary key ID:
{
"id": "1|group-123|2025-01-15T00:00:00.000Z"
}
When clicking the record, Forest Admin uses this ID to construct the detail page URL, but the lookup fails because the date format is inconsistent.
Expected ID format:
Actual ID format:
1|group-123|2025-01-15T00:00:00.000Z
Context
- Package Version:
@forestadmin/agent@1.71.2, @forestadmin/datasource-sequelize@1.13.1
- Database: MySQL
- ORM: Sequelize
- Field type:
DataTypes.DATEONLY as part of composite primary key
Workaround
Adding a getter to normalize the date format in the Sequelize model:
day: {
type: DataTypes.DATEONLY,
primaryKey: true,
allowNull: false,
get() {
const value = this.getDataValue('day');
if (value instanceof Date) {
return value.toISOString().slice(0, 10);
}
if (typeof value === 'string' && value.includes('T')) {
return value.slice(0, 10);
}
return value;
},
},