gethuman / hrsoo

Lexer/parser and formatter for hours of operation
MIT License
9 stars 2 forks source link

Cannot parse or display nighttime hours #1

Open Schoonology opened 9 years ago

Schoonology commented 9 years ago

Disclaimer: Normally I'd lead this toward a pull request, but I'm terrible with parsers.

I came upon your library looking for a way to normalize and display open hours for businesses, but the majority of the businesses I care about operate at night (bars, etc.) - hours like 10pm-2am Fri-Sat are common. I ran that through hrsoo, which produced nothing. I couldn't find a way to split those hours, either, because I couldn't find a way to put midnight as the start time for a block of hours.

I'd love to be able to use hrsoo, what can we do to solve this problem?

jeffwhelpley commented 9 years ago

Interesting. You are absolutely right that this library doesn't cover that use case yet. I am slammed this week, but should be able to add something for this next week. Two things that would help me make this change would be:

  1. The desired normalized format you want
  2. Any sample inputs that you can think of or link to. I have a list of test input strings that I use for my test cases. So you can just do a pull request adding whatever you want there and I will make it work.
Schoonology commented 9 years ago

I can do just that. Let me think about those two and put a pull request together.

Schoonology commented 9 years ago
  1. What about something like DAY-DAY 4pm-2am, ... TIMEZONE? The idea would be to continue condensing adjacent time slots across the date boundary.
  2. Attached.
jeffwhelpley commented 9 years ago

OK, I merged your test cases. Thanks for adding the format. I don't have time this week to look into this, but will make some changes next week.

jeffwhelpley commented 9 years ago

Just an update that this looks to be a bigger change than I originally thought. I took some shortcuts with the initial implementation in the lexer/parser. In order to do this right, it is going to take a bit of time. I plan on getting back to this later in the month.

Schoonology commented 9 years ago

Thanks for the status update! That's unfortunate, but understandable.