Fix tests.

This commit is contained in:
Sam Rose 2025-01-14 14:03:59 +00:00
parent e55874a698
commit 55f3dbcce5
No known key found for this signature in database
2 changed files with 4 additions and 11 deletions

View File

@ -2130,13 +2130,10 @@ if (descriptions.length) {
], ],
}, },
{ {
// This isn't ideal atm because it doesn't line up with datetime status: 400,
// and date only error messages, but there's a check earlier in
// the stack than when those errors happen that produces this one,
// and it's not easy to bypass. The key is that this fails.
status: 500,
body: { body: {
message: 'Invalid date value: "3pm"', message:
'Invalid format for field "time": "3pm". Time-only fields must be in the format "HH:MM:SS".',
}, },
} }
) )

View File

@ -175,11 +175,7 @@ export function parse(rows: Rows, table: Table): Rows {
if ([FieldType.NUMBER].includes(columnType)) { if ([FieldType.NUMBER].includes(columnType)) {
// If provided must be a valid number // If provided must be a valid number
parsedRow[columnName] = columnData ? Number(columnData) : columnData parsedRow[columnName] = columnData ? Number(columnData) : columnData
} else if ( } else if (columnType === FieldType.DATETIME) {
columnType === FieldType.DATETIME &&
!columnSchema.timeOnly &&
!columnSchema.dateOnly
) {
if (columnData && !columnSchema.timeOnly) { if (columnData && !columnSchema.timeOnly) {
if (!sql.utils.isValidISODateString(columnData)) { if (!sql.utils.isValidISODateString(columnData)) {
let message = `Invalid format for field "${columnName}": "${columnData}".` let message = `Invalid format for field "${columnName}": "${columnData}".`