GoMap
GoMap copied to clipboard
Hours `3-9 PM` interpreted as 3 AM–9 PM
I ran across a case that the hours recognizer doesn’t handle correctly:
- Input:
3-9 PM - Expected output:
15:00-21:00 - Actual output:
03:00-21:00
Screenshot:
Yeah, that's a pretty annoying edge case. You might think the fix is straightforward except that the code treats a time like "10 PM" as if was "22:00", and "3:00-22:00" makes perfect sense.
I think the heuristic I use myself is that a range typically isn’t expressed with mixed types, so e.g. Range(24HourTime, 12HourTime) isn’t a valid interpretation to begin with. There’s some analogy with how we read “10–15 million”.