Publidata / opening_hours_converter

OpenStreetMap Opening Hours to Date & Date to Opening Hours
https://rubygems.org/gems/opening_hours_converter
GNU Affero General Public License v3.0
12 stars 3 forks source link

Support "late" or "until last customer" modifier. #41

Open berkes opened 4 years ago

berkes commented 4 years ago

Strings like Mo 17:00-18:00+ exist quite a lot in the OSM planet database.

This currently fails with a Token error.

  it 'Mo 17:00-18:00+' do
    expect(OpeningHoursConverter::OpeningHoursBuilder.new.build(OpeningHoursConverter::OpeningHoursParser.new.parse('Mo 17:00-18:00+'))).to eql('Mo 17:00-18:00+')
  end
  it 'Mo 17:00-18:00+ "comment"' do
    expect(OpeningHoursConverter::OpeningHoursBuilder.new.build(OpeningHoursConverter::OpeningHoursParser.new.parse('Mo 17:00-18:00+ "comment"'))).to eql('Mo 17:00-18:00+ "comment"')
  end

The Wiki:

This may be used in place of "late" or "until last customer", e.g. 12:00+.

I can fix this, and have coded some options already, but I'd like some imput first. How do you want this handled?

  1. Ignore the +.
  2. Replace it with a comment such as "late"? If so, how to deal with the second spec, where another comment exists?
  3. Raise some error. And if so, what error?