feat(projects): accept H:MM for the task estimated-hours field (PMS-319) #169

Merged
longjacksonle merged 1 commit from feat/PMS-319-task-estimate-hhmm into main 2026-06-15 22:53:34 +02:00

Implements PMS-319.

Problem

The task "Estimated Hours" field (create and edit task forms) was <input type="number">, so H:MM could not be typed, and on the edit form an unparseable value routed through insert_opt_num was sent as null, silently wiping the stored estimate.

Changes

  • src/utils/duration.rs: parse_input_to_hours / fmt_input_hours (thin wrappers over the PMS-314 minute helpers, since estimated_hours is fractional hours) + unit tests.
  • src/pages/projects.rs: both estimate inputs switch from type="number" to free-text with a placeholder + help. Create parses via parse_input_to_hours. Edit validates before submit (empty clears it; valid sends hours; invalid errors and does not submit), replacing the silent-null insert_opt_num (removed, no other callers). Edit pre-fills via fmt_input_hours so 1.5h shows as 1:30 / 1.5.

Verification

just pre-commit (pinned rust 1.94 = CI) passes: fmt, clippy -D warnings, cargo check --target wasm32-unknown-unknown, all 91 lib tests.

Acceptance criteria

  • Create and edit forms: 1:30 -> 1.5h, 0:30 -> 0.5h; decimal (2.5, 8) still works.
  • Edit pre-fills a clean, parseable estimate and saving keeps it.
  • Unparseable estimate errors and does not submit; never silently wiped.
  • Clearing the field removes the estimate.
  • Parser unit-tested.

🤖 Generated with Claude Code

Implements PMS-319. ## Problem The task "Estimated Hours" field (create and edit task forms) was `<input type="number">`, so `H:MM` could not be typed, and on the edit form an unparseable value routed through `insert_opt_num` was sent as `null`, silently wiping the stored estimate. ## Changes - `src/utils/duration.rs`: `parse_input_to_hours` / `fmt_input_hours` (thin wrappers over the PMS-314 minute helpers, since `estimated_hours` is fractional hours) + unit tests. - `src/pages/projects.rs`: both estimate inputs switch from `type="number"` to free-text with a placeholder + help. Create parses via `parse_input_to_hours`. Edit validates before submit (empty clears it; valid sends hours; invalid errors and does not submit), replacing the silent-null `insert_opt_num` (removed, no other callers). Edit pre-fills via `fmt_input_hours` so 1.5h shows as `1:30` / `1.5`. ## Verification `just pre-commit` (pinned rust 1.94 = CI) passes: fmt, clippy `-D warnings`, `cargo check --target wasm32-unknown-unknown`, all 91 lib tests. ## Acceptance criteria - [x] Create and edit forms: `1:30` -> 1.5h, `0:30` -> 0.5h; decimal (`2.5`, `8`) still works. - [x] Edit pre-fills a clean, parseable estimate and saving keeps it. - [x] Unparseable estimate errors and does not submit; never silently wiped. - [x] Clearing the field removes the estimate. - [x] Parser unit-tested. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(projects): accept H:MM for the task estimated-hours field (PMS-319)
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 59s
294a3ef628
The task "Estimated Hours" field (create and edit task forms) was an <input type="number">, so the browser blocked H:MM input, and on the edit form an unparseable value routed through insert_opt_num was sent as null, silently wiping the stored estimate. Both forms now accept decimal hours or H:MM, reusing the Log Time parser (PMS-314).

src/utils/duration.rs: add parse_input_to_hours / fmt_input_hours, thin wrappers over the minute-based helpers (estimated_hours is fractional hours, not whole minutes), with unit tests.

src/pages/projects.rs: both estimate inputs switch from type="number" to free-text with a placeholder and help showing both formats. The create handler parses via parse_input_to_hours. The edit handler validates the estimate before submit (empty clears it; valid sends hours; invalid shows an error and does not submit), replacing the silent-null insert_opt_num, which is removed as it had no other callers. The edit form pre-fills via fmt_input_hours so an estimate stored as 1.5h shows as "1:30" / "1.5".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
longjacksonle deleted branch feat/PMS-319-task-estimate-hhmm 2026-06-15 22:53:34 +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!169
No description provided.