You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.7 KiB
1.7 KiB
+++ title = "Submit form: date field should use type=date for calendar picker" priority = 5 status = "done" ticket_type = "bug" dependencies = [] +++
Bug
The date field on the submit form (src/bin/ui/pages/submit.rs, around line 200–215) uses type="text" with a placeholder hinting at YYYY-MM-DD format. This means:
- No calendar UI — users must type the date manually
- No browser-native date validation
- No consistent format enforcement
Expected behaviour
The date field should use type="date", which:
- Provides a browser-native calendar picker on supported browsers
- Automatically enforces valid date format
- Returns the value as a YYYY-MM-DD string, which matches the API's
datefield format — no conversion needed
How to fix
In src/bin/ui/pages/submit.rs:
- Change the
typeattribute on the date<input>from"text"to"date"(~line 204). - Remove or update the label text — it currently says
"Date (optional, YYYY-MM-DD)". Withtype="date", the format hint is no longer needed. Change to"Date (optional)". - Remove the
placeholderattribute —type="date"inputs do not display placeholder text in most browsers; it is redundant. - The
oninputhandler reads.value()from theHtmlInputElement, which is already correct —type="date"returns the value in YYYY-MM-DD format, so no changes needed to data handling.
Note: The existing HtmlInputElement import is already correct. No new imports needed.
File
src/bin/ui/pages/submit.rs(~lines 199–215)
Validation
# From quotesdb/ root
cargo fmt && cargo check && cargo clippy && cargo test
trunk build
Manually verify the date field shows a calendar picker in the browser.
Commit scope
fix(quotesdb): submit form date input type