Converts opening hours written for humans into the OSM opening_hours syntax and applies it to the
selected objects.
Mon-Fri 9am-5pm Mo-Fr 09:00-17:00;
Sat 10-2 → Sa 10:00-14:00;
Closed Sunday Su off
Data → Paste opening hours… (Ctrl+Alt+Shift+H), with at least one object selected.
The dialog pre-fills from the clipboard. The converted value appears below the paste box and is
editable — once you type in it, the parser stops overwriting your edit until you change the pasted
text again. Apply is enabled whenever the value is valid opening_hours syntax, and writes the tag
through JOSM's undo stack.
Anything the parser did not understand is listed below the value rather than dropped silently.
- Day names and ranges in any of the usual spellings:
Mon,Monday,Mo,Mon-Fri,Mon/Wed/Fri,Sat & Sun,weekdays,weekends,daily - 12- and 24-hour times:
9am-5pm,9:00 AM – 5:00 PM,06:00-11:00,noon,midnight - Bare numbers, where am/pm is inferred:
9-5→09:00-17:00,10-2→10:00-14:00 Closed Sunday→Su off,24/7andOpen 24 hours→24/7- Split shifts:
Mon 9-12, 1-5→Mo 09:00-12:00,13:00-17:00 - Days on their own line, the way a table pastes, and days written after the times
(
9am-5pm Monday through Friday) - Table columns with no dash at all, where the opening and closing times are just separated by
whitespace or tabs:
Monday⇥9:00 AM⇥5:30 PM - Open-ended hours:
10am to Close/5pm to close→10:00+/17:00+ - Food/kitchen service hours (
Food served 11am-10pm) are noted rather than folded into the general schedule, sinceopening_hoursdescribes access, not a specific service - Conflicting hours given for the same day (e.g. a schedule change the parser can't tie to a date range it understands) are reported rather than merged into a broken value
Not handled: public holidays (PH), comments such as "by appointment", and seasonal or month
based rules. Those show up as unrecognized text for you to add by hand.
Needs a JOSM checkout with dist/josm-custom.jar built.
ant -Djosm.dir=/path/to/josm dist # build dist/openinghours.jar
ant -Djosm.dir=/path/to/josm test # run the parser corpus
ant -Djosm.dir=/path/to/josm install # copy the jar to ~/Library/JOSM/pluginsAfter install, enable openinghours in JOSM's plugin preferences.
Unit tests use the JUnit 5 jars from ~/.ivy2/cache, which the JOSM build populates.
src/…/openinghours/parse/ holds the conversion and has no dependency on JOSM classes, so it can be
tested on its own. The pipeline is:
TextNormalizer → Tokenizer → FragmentParser → ScheduleBuilder → OpeningHoursValidator
lower case, day/time tokens into per-day schedule ch.poole parser checks
ASCII dashes, tokens day + time merged into rules and normalizes formatting
one line per fragments
fragment
The validator wraps ch.poole.openinghoursparser, which JOSM already ships and exposes to plugins,
so nothing extra is bundled.
GPLv2 or later. See LICENSE.