simonpoole / OpeningHoursParser

Parser for string values according to the OSM opening hours specification
MIT License
32 stars 12 forks source link

Add evaluation method #10

Open simonpoole opened 7 years ago

simonpoole commented 7 years ago

Support evaluation of the OH values.

ramsestom commented 6 years ago

Still planned?

simonpoole commented 6 years ago

Sure

ramsestom commented 6 years ago

Cool. Any deadline?

archanox commented 2 years ago

Hi, I came across this project looking to have a "simple" input opening hours string and a given date/time and evaluate if it is deemed open (true or false). I had a look at the docs and wasn't able to find anything along those lines, what would be the best approach here to do this? Or would running the javascript version serverside be the only option here?

simonpoole commented 2 years ago

@archanox I had forgotten that this issue was still open :-). There was a 2021 GSOC project to write an evaluator, utilizing this parser: https://github.com/goodudetheboy/OpeningHoursEvaluator

This works quite well as such, however it currently has a dependency on a timezone library that takes ages to load and uses a fair bit of memory making is not really suitable for interactive use, but for bulk processing or a server process that is long lived that isn't relevant. I'm low prio working on an alternative for that dependency but that has stalled a bit.

archanox commented 2 years ago

Thanks for the tip @simonpoole, I'm currently porting both of these to C# into the one library. So I'll be cleaning up the timezone stuff as I go along.

Edit: It looks like I'm using https://github.com/leonardehrenfried/opening-hours-evaluator instead of the library from goodudetheboy