Skip to content

Conversation

dayleclarke
Copy link

@dayleclarke dayleclarke commented Sep 17, 2025

Summary
The time wheel on web couldn’t select 00 because the wheel compared values with strict equality between mixed types (e.g. "00" vs 0). This PR normalises comparisons to numbers and always emits numeric values, so "00", "0", and 0 are treated the same.

Problem

  • wheel-web.tsx used item.value === value in several places.
  • On web, hour/minute options may be zero-padded strings (e.g. "00"), while the current value is a number (0).
  • Strict equality failed, so the wheel couldn’t “land” on 00.

What changed

  • In src/components/time-picker/wheel-web.tsx:
    • Find current index with Number(item.value) === Number(value).
    • On release, compare numerically and emit Number(newValue.value).
    • Dim/selected state comparisons switched to numeric comparison as well.

Why this approach

  • Smallest change, scoped to the web wheel only.
  • Keeps public API behaviour stable for consumers (downstream logic keeps receiving numbers).
  • No impact on iOS/Android implementations.

Notes
(Optional) If you’d like, I can follow up with a type-only PR to narrow setValue?: (value: number) => void since we now always emit numbers.

Closes #210
Testing

Manual Testing
00:00 time can now be selected via the wheels on the web as shown here:
image

Automated Unit Tests
Added web wheel tests to ensure ‘00’ is selectable—simulate a one-step drag via a mocked PanResponder and assert it emits numeric 0 (and no-op when unchanged), covering mixed string/number values to guard against regressions.

@dayleclarke dayleclarke changed the title fix(web): make time wheel accept 00 via numeric comparison… fix: make time wheel accept 00 via numeric comparison… Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to Select 00:00 time
1 participant