You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -283,7 +277,7 @@ function getReadableState(startString, endString, oh, past) {
283
277
284
278
## Library API
285
279
286
-
-`var oh = new opening_hours('We 12:00-14:00', nominatim_object, mode);`
280
+
-`let oh = new opening_hours('We 12:00-14:00', nominatim_object, mode);`
287
281
288
282
-`value (mandatory, type: string)`: Constructs opening_hours object, given the opening_hours tag value. Throws an error string if the expression is malformed or unsupported.
289
283
@@ -328,13 +322,13 @@ function getReadableState(startString, endString, oh, past) {
328
322
329
323
- additional_rule_separator (type boolean, default true)`: Allows to disable the "additional_rule_separator not used after time wrapping midnight" check giving rise to the warning "This rule overwrites parts of the previous rule. This happens because normal rules apply to the whole day and overwrite any definition made by previous rules. You can make this rule an additional rule by using a "," instead of the normal ";" to separate the rules. Note that the overwriting can also be desirable in which case you can ignore this warning."
330
324
331
-
- `var warnings = oh.getWarnings();`
325
+
- `let warnings = oh.getWarnings();`
332
326
333
327
Get warnings which appeared during parsing as human readable string array with one element per violation. Almost all warnings can be auto-corrected and are probably interpreted as intended by the mapper. However, this is not a granite of course.
334
328
335
329
This function performs some additional testing and can thus also theoretically throw an error like all other functions which parse the time.
Return a prettified version of the opening_hours value. The value is generated by putting the tokens back together to a string.
340
334
@@ -355,11 +349,11 @@ function getReadableState(startString, endString, oh, past) {
355
349
356
350
If the key 'get_internals' is true then an object containing internal stuff will be returned instead. The format of this internal object may change in minor release.
357
351
358
-
-`var every_week_is_same = oh.isWeekStable();`
352
+
-`let every_week_is_same = oh.isWeekStable();`
359
353
360
354
Checks whether open intervals are same for every week. Useful for giving a user hint whether time table may change for another week.
Returns date of next state change. You may omit *date* to use current date.
420
414
421
415
Returns undefined if the next change cannot be found. This may happen if the state won't ever change (e.g. `24/7`) or if search goes beyond *limit* (which is *date* + ~5 years if omitted).
422
416
423
-
- `var rule_index = oh.getMatchingRule(date);`
417
+
- `let rule_index = oh.getMatchingRule(date);`
424
418
425
419
Returns the internal rule number of the matching rule. You may omit *date* to use current date.
426
420
A opening_hours string can consist of multiple rules from which one of them is used to evaluate the state for a given point in time. If no rule applies, the state will be closed and this function returns undefined.
427
421
428
422
To prettify this rule, you can specify `rule_index` as parameter for `oh.prettifyValue` like this:
429
423
430
424
```js
431
-
var matching_rule = oh.prettifyValue({ rule_index: rule_index });
425
+
let matching_rule = oh.prettifyValue({ rule_index: rule_index });
432
426
```
433
427
434
428
### High-level API
435
429
436
430
Here and below, unless noted otherwise, all arguments are expected to be and all output will be in the form of Date objects.
437
431
438
-
-`var intervals = oh.getOpenIntervals(from, to);`
432
+
-`let intervals = oh.getOpenIntervals(from, to);`
439
433
440
434
Returns array of open intervals in a given range, in a form of
441
435
@@ -445,49 +439,49 @@ Here and below, unless noted otherwise, all arguments are expected to be and all
445
439
446
440
Intervals are cropped with the input range.
447
441
448
-
-`var duration = oh.getOpenDuration(from, to);`
442
+
-`let duration = oh.getOpenDuration(from, to);`
449
443
450
444
Returns an array with two durations for a given date range, in milliseconds. The first element is the duration for which the facility is open and the second is the duration for which the facility is maybe open (unknown is used).
451
445
452
446
### Iterator API
453
447
454
-
-`var iterator = oh.getIterator(date);`
448
+
-`let iterator = oh.getIterator(date);`
455
449
456
450
Constructs an iterator which can go through open/close points, starting at *date*. You may omit *date* to use current date.
457
451
458
-
-`var current_date = iterator.getDate();`
452
+
-`let current_date = iterator.getDate();`
459
453
460
454
Returns current iterator position.
461
455
462
456
-`iterator.setDate(date);`
463
457
464
458
Set iterator position to date.
465
459
466
-
-`var is_open = iterator.getState();`
460
+
-`let is_open = iterator.getState();`
467
461
468
462
Returns whether the facility is open at the current iterator position.
469
463
470
-
-`var unknown = iterator.getUnknown();`
464
+
-`let unknown = iterator.getUnknown();`
471
465
472
466
Checks whether the opening state is conditional or unknown at the current iterator position.
Returns the index of the matching rule starting with zero.
489
483
490
-
-`var had_advanced = iterator.advance(limit);`
484
+
-`let had_advanced = iterator.advance(limit);`
491
485
492
486
Advances an iterator to the next position, but not further than *limit* (which is current position + ~5 years if omitted and is used to prevent infinite loop on non-periodic opening_hours, e.g. `24/7`), returns whether the iterator was moved.
493
487
@@ -586,7 +580,7 @@ Almost everything from opening_hours definition is supported, as well as some ex
586
580
-[Croatia][ph-hr]
587
581
-[Czech Republic][ph-cz]
588
582
-[Denmark][ph-dk]
589
-
-[Englandand Wales][ph-gb]
583
+
-[England, Wales, Scotland and Northern Ireland][ph-gb]
590
584
-[France][ph-fr]
591
585
- Finland
592
586
-[Germany][ph-de] ([footnotes][ph-de] are ignored)
@@ -849,7 +843,7 @@ Note that the original work from Dmitry Marakasov is published under the BSD 2-c
849
843
850
844
<https://reuse.software> is used. The year of initial publication is used and not updated. When you as new author make copyrightable changes, you are free of course to add a `SPDX-FileCopyrightText` line to the file(s) you changed with the year of the contribution. Please use a format like this:
0 commit comments