Both listByCompany and exportCsv in app/controllers/timeentrycontroller.js declare in a doc comment that "bad dates are silently dropped rather than 400'd." The implementation doesn't match: the raw req.query.from / req.query.to string is plugged straight into Sequelize's Op.gte / Op.lte.
Postgres parses ISO 8601 fine but throws invalid input syntax for type timestamp on garbage like ?from=not-a-date, which Sequelize surfaces. The controller's catch returns a 500.
So GET /v1/timeentry/bycompany/1?from=garbage returns 500 instead of "treat as no filter" as documented.
Fix: add a parseDateOrNull(s) helper that returns a Date for valid inputs and null otherwise. Wire both handlers through it. Unit-test via the _internals export.
Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/
Both
listByCompanyandexportCsvinapp/controllers/timeentrycontroller.jsdeclare in a doc comment that "bad dates are silently dropped rather than 400'd." The implementation doesn't match: the rawreq.query.from/req.query.tostring is plugged straight into Sequelize'sOp.gte/Op.lte.Postgres parses ISO 8601 fine but throws
invalid input syntax for type timestampon garbage like?from=not-a-date, which Sequelize surfaces. The controller's catch returns a 500.So
GET /v1/timeentry/bycompany/1?from=garbagereturns 500 instead of "treat as no filter" as documented.Fix: add a
parseDateOrNull(s)helper that returns a Date for valid inputs and null otherwise. Wire both handlers through it. Unit-test via the_internalsexport.Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/