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

+++ 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 200215) 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 date field format — no conversion needed

How to fix

In src/bin/ui/pages/submit.rs:

  1. Change the type attribute on the date <input> from "text" to "date" (~line 204).
  2. Remove or update the label text — it currently says "Date (optional, YYYY-MM-DD)". With type="date", the format hint is no longer needed. Change to "Date (optional)".
  3. Remove the placeholder attribute — type="date" inputs do not display placeholder text in most browsers; it is redundant.
  4. The oninput handler reads .value() from the HtmlInputElement, 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 199215)

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