Support flexible datetime formats in job creation/update forms#38
Support flexible datetime formats in job creation/update forms#38knutties wants to merge 1 commit into
Conversation
The dashboard's job form posts `datetime-local` values (e.g.
`2026-06-09T17:18`, no seconds, no offset) for `run_at`, `starts_at`,
and `ends_at`. chrono's default `DateTime<Utc>` deserializer only
accepts full RFC 3339, so these requests failed with the opaque
"Json deserialize error: premature end of input".
- Add a flexible deserializer for these fields that accepts both
RFC 3339 (with offset/`Z`) and tz-less datetime-local values,
interpreting the latter as UTC.
- Install an actix JsonConfig error handler so malformed bodies return
the structured `{ error: { code, message } }` 400 the rest of the API
uses, instead of actix's raw plaintext error.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR improves API request handling by adding a custom JSON error formatter and enabling job timestamps to accept dashboard-compatible datetime formats. The error handler structures malformed JSON responses; the flexible datetime module parses RFC 3339 or local datetime strings for job creation and updates. ChangesAPI Request Handling Improvements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
This PR improves the user experience of the job creation and update forms by accepting flexible datetime formats from HTML
<input type="datetime-local">elements, while also standardizing API error responses for malformed JSON requests.Key Changes
Added flexible datetime deserialization module (
flexible_datetimeinjob.rs):2026-06-09T17:18:00Z) and HTML datetime-local values (e.g.,2026-06-09T17:18)Applied flexible datetime deserialization to timestamp fields:
CreateJob:run_at,starts_at,ends_atUpdateJob:starts_at,ends_atStandardized JSON deserialization error responses in the API:
json_error_handlerto convert actix-web's default plaintext error messages into the structured{ "error": { code, message, request_id } }format used throughout the APIImplementation Details
The flexible datetime parser tries formats in order:
ZsuffixYYYY-MM-DDTHH:MM:SS)YYYY-MM-DDTHH:MM)This allows the dashboard's job form to work seamlessly with HTML5 datetime-local inputs while maintaining backward compatibility with RFC 3339 timestamps from other clients.
https://claude.ai/code/session_01TYy8xee53T2SBYFf5ifgjq
Summary by CodeRabbit
Release Notes
New Features
Improvements