Git Product home page Git Product logo

opening-hours / opening_hours.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amdmi3/opening_hours.js

214.0 214.0 117.0 6.39 MB

Library to parse and process the opening_hours tag from OpenStreetMap data

Home Page: https://openingh.ypid.de/evaluation_tool/

CSS 0.31% Shell 0.56% HTML 1.99% JavaScript 91.24% Python 3.10% Makefile 2.14% Haxe 0.56% Perl 0.10%
javascript-library npm-package opening-hours openinghours openstreetmap openstreetmap-data openstreetmap-validator

opening_hours.js's People

Contributors

1ec5 avatar afita avatar amdmi3 avatar amenk avatar andreastuhu avatar blef00fr avatar burrbull avatar calderis avatar chiak597 avatar debyos avatar dex2000 avatar don-vip avatar edqd avatar elgaard avatar fodor0205 avatar gerw88 avatar hariskar avatar holgerjeromin avatar janjko avatar kristjanesperanto avatar mstock avatar napei avatar nonnemilia avatar pietervdvn avatar putnik avatar rmikke avatar simon04 avatar simonpoole avatar spawn-guy avatar ypid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opening_hours.js's Issues

detect language before translating

For example "Pon-Cz 12:00-22:00;Pt-So 12:00-13:00;N 12:00-22:00" is relatively easy detectable as Polish rather than German, but currently "so" is changed because it fits German shortcut.

Upgrade of #10

Incorrect Russian remaining time i18n

Demo use "minute" and "hour" for 1 and "minute_plural" and "hour_plural" for more then 1. But not use "minute_many" and "hour_many".
Откроется завтра, 7 Апреля, через 16 часа and 35 минуты. It's wrong.
Correct is Откроется завтра, 7 Апреля, через 16 часов and 35 минут.
In i18next code:
"ru": {
"name": "Russian",
"numbers": [
1,
2,
5
],
"plurals": function(n) { return Number(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); }
},
return 0, 1 and 2.
But it's not using.
Program calculate
"plurals": function(n) { return Number(n > 1); }

Encoding opening hours

It would be nice to support the creation of opening hours strings (for example as in the JOSM plugin).

Nominatim lookup assumes same country code and language code

When doing a lookup of a location in a country where the country code is not the same as the language code for that country, state names may be presented in a non-local language.

As an example on demo page:

Latitude: 55
Longitude: -82
country: ca
state: Ontàrio

Country 'ca' should instead be mapped to 'en,fr', which should display state: Ontario

There is a list of Country Codes on the wiki, but I am not aware of an API or OSM library that does conversions/lookups.

The website is down?

Hi,
I wanted to test the evaluation tools mentioned on the main page of your project. But the link is down. Do you know reasons of that problem?

Thank's

Detect used language for correction of weekdays.

Most of the weekday names and abbreviations are unique over the different languages. But there are some with the same name, but different meanings. See #10.

Try to auto detect the language and use this for names which have multiple meanings. This feature has very less priority because it’s implementation afford is high in contrast of it’s probable use.

Josm-check don't find an specific (tricky) Error

Dunno about im right here with that:

following way: https://www.openstreetmap.org/way/125170567 (not changed by me)
Mo-Fr 05:00-21:00; Sa;Su 07:00-21:00; PH 07:00-21:00

opening_hours (in the qat-script) found right warning, josm-check not.

German:
Keine Ahnung, ob ich hier richtig bin.
Gerade obiges mit dem opening_hours-qat-script reingeholt, ich mache zusätzlich eine Josm-prüfung. Diese gibt mir keine Warnung aus. Sollte aber meines Erachtens (obwohl die Regel formal korrekt ist)

Conflict when 'Open with comment' appears with 'off'

Mo-Fr 07:00-19:30; Sa-Su 08:00-19:30; 19:30-21:00 open "No new laundry loads in"; Nov Th[4] off; Dec 25 off

This evaluates on http://openingh.openstreetmap.de/evaluation_tool/ , if you look at December 25, 20:25:

Facility is now closed, comment: "No new laundry loads in"
but will close today, 25 December, in 35 minutes.

Expected result would be:
Facility is now closed.

Evaluation shouldn't return a comment from an 'Open' string when the facility is ultimately closed, nor indicate that the facility 'will close soon', because it already is.

warn about overlapping date info

Feb 2-Oct 15 09:00-18:30; Oct 16-Nov 15 09:00-17:30; Nov 16-Feb 15 09:00-16:30
When is the feature open on the Feb 10th? Till 18:30 or 16:30?
Thank you for this amazing code :-)

Attempt translation in prettification (data for translation from Polish)

Real world example: http://www.openstreetmap.org/browse/node/1994157720 "opening_hours = Pon-Cz 12:00-22:00;Pt-So 12:00-13:00;N 12:00-22:00"

Translation should probably be used as last resort.

Translation from Polish to English:

poniedziałek, poniedzialek, pon, pn -> Mo
wtorek, wt -> Tu
środa, sroda, śr, sr -> We
czwartek, czw, cz -> Th
piątek, piatek, pt -> Fr
sobota, sob, so -> Sa
niedziela, niedz, N, ndz -> Su

In addition - shorter forms may be suffixed with . sign

little confusing about a month rule

sorry for using Bugtracker as request forum ;)

May,Sep Mo 21:00+; [...]

is the correct (OH-map says) rule for

Mondays in May and Mondays in September

but i don't understand that, my head wants to render:

May all days, Sep only Mo.

Who is wrong?

Sa 7-13:30

Prettifier is unable to recognise it as Sa 7:00-13:30.

"Sa 7-13" is recognised as "Sa 7:00-13:00" with comment

(Time range without minutes specified. Not very explicit! Please use this syntax instead e.g. "12:00-14:00".)

(EDIT: I encountered it in real OSM data, in edit https://www.openstreetmap.org/changeset/28047201 I fixed tag that had this problem).

ClassCastException when validating "SH off" with Java 8

Hi,
We have a bug with JOSM if we validate opening_hours=SH offwith Java 8:
https://josm.openstreetmap.de/ticket/10423

The bug does not occur with Java 7. I suspected a Java 8 regression but after further investigation I think this a "feature". Java 8 introduced a new JavaScript engine, called Nashorn:

http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/

It is a strict implementation of ECMAScript Edition 5.1 and does not include any feature appeared with ECMAScript 6.

The bug occurs with this instruction:

return [ true, new Date(date.getFullYear() + holiday_ends_next_year, holiday[2+h] - 1, holiday[3+h] + 1),
    applying_holidays[i].name ];

I believe the nameproperty is new with ECMAScript 6:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name

and that would make Nashorn fail. Is it possible to not use this property and stay strictly compliant to ECMAScript 5.1 ?

Provide holiday data and basic functions as separate (npm) module

As suggested by AMDmi3 a long time ago.

There are quite some holiday modules already on npm. I will have to check them out and see which ones can be reused.

This is also intended to allow holiday definitions of arbitrary complexity. See Russian holidays and US holidays. And to allow other projects to reuse the handy list of public/school holidays which this library has collected by now.

  • Review other npm packages and add refs to readme or check if a package already exists which uses a similar format than opening_hours.js and discuss if projects can/should merge.
  • Create package.json below holidays.
  • Compile legacy JS file with rollup below holidays.
  • Write readme how the holidays can be used standalone (ES6, and legacy JavaScript) (importing and accessing should be enough. Users will need to figure out how to evaluated them on their one).
  • Publish to npm. @ypid would like to do this to stay in control of the holidays.

Using moment.js for date localization

Hi!

Have you thought about using Moment.js for date localization. I think it is better to use some library than to translate months and dates for each language. License is MIT which I think is compatible with BSD.

missing links in readme

"Please have a look at the [evaluation tool][] which can give you an impression how this library can be used and what it is capable of." - in general, search for []

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.