fix(time): accept fractional hours in Log Time form (PMS-233) #116

Merged
longjacksonle merged 1 commit from fix/mapps-233-fractional-hours into main 2026-06-12 07:06:10 +02:00

What

The Log Time form's Hours field rejected fractional values: typing 2.5 was blocked by the browser before submit, so a tech could only log whole hours (PMS-233).

Root cause

The Hours field is an <input type="number"> rendered by the shared Input component, which exposed no step attribute. Per the HTML spec a type="number" input defaults to step=1, so the browser's native constraint validation treats any non-integer as invalid and the value never reaches the submit handler. The Rust submit path was already decimal-correct (parses f64, stores (hours * 60).round() minutes); the bug was purely the missing step.

Change

  • Add an optional step prop to InputProps in src/components/form.rs and emit it on the <input> (no-op for non-number inputs).
  • Set step="0.25" on the Hours input in src/pages/time.rs so quarter-hour increments are accepted, matching the 0.00 placeholder and the f64 submit path.

Verification

  • cargo check --target wasm32-unknown-unknown passes.
  • 2.5 now submits and persists as duration_minutes = 150; whole numbers still work.

🤖 Generated with Claude Code

## What The Log Time form's Hours field rejected fractional values: typing `2.5` was blocked by the browser before submit, so a tech could only log whole hours (PMS-233). ## Root cause The Hours field is an `<input type="number">` rendered by the shared `Input` component, which exposed no `step` attribute. Per the HTML spec a `type="number"` input defaults to `step=1`, so the browser's native constraint validation treats any non-integer as invalid and the value never reaches the submit handler. The Rust submit path was already decimal-correct (parses `f64`, stores `(hours * 60).round()` minutes); the bug was purely the missing `step`. ## Change - Add an optional `step` prop to `InputProps` in `src/components/form.rs` and emit it on the `<input>` (no-op for non-number inputs). - Set `step="0.25"` on the Hours input in `src/pages/time.rs` so quarter-hour increments are accepted, matching the `0.00` placeholder and the f64 submit path. ## Verification - `cargo check --target wasm32-unknown-unknown` passes. - `2.5` now submits and persists as `duration_minutes = 150`; whole numbers still work. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(time): accept fractional hours in Log Time form (PMS-233)
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 1m57s
357f5cec2d
The Hours field is an <input type="number"> with no step attribute, so the browser defaults to step=1 and rejects fractional values like 2.5 via native constraint validation before submit. The Rust submit path already parses the field as f64 and stores (hours * 60).round() minutes, so the bug was purely the missing step on the input element.

Add an optional step prop to the shared Input component and emit it on the <input> (no-op for non-number inputs), then set step="0.25" on the Hours field so quarter-hour increments are accepted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
longjacksonle deleted branch fix/mapps-233-fractional-hours 2026-06-12 07:06:10 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
psa-systems/mokosh-apps!116
No description provided.