Skip to content

feat: Add "00" in the minute slot when a number is entered in the hour slot (vehicle creation) #209

Description

@kirillakovalenko

Description

In the vehicle departure-time entry on the add/edit vehicle overlay
(VehicleDetailsOverlay.tsx),
the hour (HH) and minute (MM) fields are separate inputs. When a user types an hour and
moves on, the minutes field is often left blank, which fails validation
(isValidTime) and
forces the user to manually type 00. The overwhelmingly common case is an on-the-hour
departure (e.g. 9:00), so we should default the minutes to 00 automatically once the
hour is entered.

Goal

When a user enters a value in the hour field, the minute field auto-fills with 00 unless
the user types their own minutes.

Scope

In scope

  • In VehicleDetailsOverlay.tsx,
    when a valid hour is entered and the minutes field is empty, set minutes to "00".
  • Keep the auto-filled 00 editable — if the user types in the minutes field, their input
    replaces the default rather than appending to it.
  • Ensure the auto-filled value flows through existing validation and the
    departureTime string built at
    line 164.

Out of scope

  • Changing the two-field layout into a single combined time input or a time picker.
  • Applying the same behavior to any other time fields (e.g. address time windows).
  • Changing meridiem (am/pm) defaulting behavior.

Acceptance Criteria

  • Typing a number in the hour field auto-populates the minute field with 00 when it
    is empty.
  • If the user types their own minutes (before or after entering the hour), their value
    is kept and not overwritten by 00.
  • A vehicle entered with only an hour saves with a valid HH:00am/pm departure time
    and passes validation without a "departure" error.
  • Existing auto-focus behavior (hour → minutes on 2 digits, backspace from empty
    minutes → hours) still works.
  • Unit/UI test added covering the auto-fill and the user-override cases.

Assignee

@Gill87

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions