GoMap icon indicating copy to clipboard operation
GoMap copied to clipboard

Hours `3-9 PM` interpreted as 3 AM–9 PM

Open AndrewKvalheim opened this issue 3 years ago • 2 comments

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:

screenshot

AndrewKvalheim avatar Mar 06 '22 00:03 AndrewKvalheim

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.

bryceco avatar Mar 06 '22 02:03 bryceco

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”.

AndrewKvalheim avatar Mar 10 '22 19:03 AndrewKvalheim