opening_hours 3.8.0-dev → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.rst +33 -2
- package/Makefile +1 -1
- package/build/opening_hours.js +537 -57
- package/package.json +20 -20
- package/site/js/i18n-resources.js +202 -124
- package/site/js/opening_hours_table.js +14 -5
- package/types/index.d.ts +6 -9
|
@@ -36,9 +36,17 @@ var OpeningHoursTable = {
|
|
|
36
36
|
atday = i18next.t('words.today');
|
|
37
37
|
else if (from ? (nextdays < 2) : (nextdays <= 2))
|
|
38
38
|
atday = i18next.t('words.tomorrow');
|
|
39
|
-
else if (from ? (nextdays < 7) : (nextdays <= 7))
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
else if (from ? (nextdays < 7) : (nextdays <= 7)) {
|
|
40
|
+
if (i18next.exists('weekdays.days next week.' + this.weekdays[nextchange.getDay()])) {
|
|
41
|
+
atday = i18next.t('weekdays.days next week.' + this.weekdays[nextchange.getDay()], {
|
|
42
|
+
day: nextchange.toLocaleString(i18next.language, {weekday: 'long'})
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
atday = i18next.t('weekdays.day next week', {
|
|
46
|
+
day: nextchange.toLocaleString(i18next.language, {weekday: 'long'})
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
42
50
|
|
|
43
51
|
var month_name = nextchange.toLocaleString(i18next.language, {month: 'long'});
|
|
44
52
|
var month_name_match = month_name.match(/\(([^|]+?)\|.*\)/);
|
|
@@ -133,8 +141,9 @@ var OpeningHoursTable = {
|
|
|
133
141
|
table[row].times += '<div class="timebar ' + (is_open ? 'open' : (unknown ? 'unknown' : 'closed'))
|
|
134
142
|
+ '" style="width:' + (to-fr) + '%"></div>';
|
|
135
143
|
if (is_open || unknown) {
|
|
136
|
-
var text = i18next.t('words.' + state_string) + ' ' +
|
|
137
|
-
|
|
144
|
+
var text = i18next.t('words.' + state_string) + ' ' +
|
|
145
|
+
i18next.t('words.from') + ' ' + this.printTime(prevdate) +
|
|
146
|
+
' ' + i18next.t('words.to') + ' ';
|
|
138
147
|
if (prevdate.getDay() !== curdate.getDay())
|
|
139
148
|
text += '24:00';
|
|
140
149
|
else
|
package/types/index.d.ts
CHANGED
|
@@ -18,25 +18,22 @@ declare module 'opening_hours' {
|
|
|
18
18
|
getOpenIntervals(
|
|
19
19
|
from: Date,
|
|
20
20
|
to: Date
|
|
21
|
-
): [
|
|
22
|
-
[Date, Date, boolean, string | undefined],
|
|
23
|
-
[Date, Date, boolean, string | undefined]
|
|
24
|
-
]
|
|
21
|
+
): [Date, Date, boolean, string | undefined][]
|
|
25
22
|
getStatePair(
|
|
26
23
|
date?: Date
|
|
27
24
|
): [boolean, Date, boolean, string | undefined, number | undefined]
|
|
28
25
|
getWarnings(): string[]
|
|
29
26
|
isEqualTo(
|
|
30
27
|
second_oh_object: opening_hours,
|
|
31
|
-
start_date
|
|
28
|
+
start_date?: Date
|
|
32
29
|
): boolean
|
|
33
30
|
isWeekStable(): boolean
|
|
34
|
-
prettifyValue(argument_hash
|
|
31
|
+
prettifyValue(argument_hash?: argument_hash): string
|
|
35
32
|
getIterator(date?: Date): opening_hours_iterator
|
|
36
33
|
}
|
|
37
34
|
export default opening_hours
|
|
38
35
|
|
|
39
|
-
export
|
|
36
|
+
export class opening_hours_iterator {
|
|
40
37
|
getDate(): Date
|
|
41
38
|
setDate(date: Date): void
|
|
42
39
|
getState(date?: Date): boolean
|
|
@@ -73,13 +70,13 @@ declare module 'opening_hours' {
|
|
|
73
70
|
locale: string
|
|
74
71
|
}
|
|
75
72
|
|
|
76
|
-
export
|
|
73
|
+
export enum mode {
|
|
77
74
|
time_ranges = 0,
|
|
78
75
|
points_in_time = 1,
|
|
79
76
|
both = 2,
|
|
80
77
|
}
|
|
81
78
|
|
|
82
|
-
export
|
|
79
|
+
export enum warnings_severity {
|
|
83
80
|
warning = 4,
|
|
84
81
|
notice = 5,
|
|
85
82
|
info = 6,
|