@sarimarcus/content-sites-core 0.31.4 → 0.31.6

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.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All packages in the platform release in lockstep; entries are per release version.
4
4
 
5
+ ## 0.31.6 (2026-10-08)
6
+
7
+ - `./schema` adds the opening-hours display text: `openingHoursRows`, `openingHoursSummary`, `latestClosing` and the `OpeningHours` and `HoursRow` types, the Córdoba and Granada `src/utils/openingHours.ts` (`latestClosing` is Granada's: a close ranks against its own shift's open, and the label names every day closing then). Day resolution is `resolveOpeningHours`, the one the JSON-LD uses; values display as written. Output equals both sites' files on all 121 bar, restaurant and hotel items; adopting it changes 7 Córdoba bar-card badges from "(Mon–Fri)" to "(Daily)" (`extracted.json` entry: no-recreate enforces the move from 0.32.0, and a site may adopt earlier with `rewrite-imports.mjs --delete-local`, which moves the imports and deletes the site file) (SLA-3023).
8
+ - Fixed: `./schema` `resolveOpeningHours` gives `alwaysOpen` only the days no other bucket or per-day key covers. An `alwaysOpen` object with a `weekdays` or `weekends` bucket emitted both the bucket's hours and 00:00-23:59 for those days. No item has that shape: JSON-LD and `assertedOpenDays` are unchanged on all 155 items with an `openingHours` object (SLA-3023).
9
+
10
+ ## 0.31.5 (2026-10-08)
11
+
12
+ - `./schema`: `activityBuilder` sets `isAccessibleForFree` from `isFreeEntry`, like the other builders. A `free` tag now counts, and a price that opens with a conditional "Free" ("Free (self-guided) or from €25") omits the property instead of asserting `false`. Changed pages: Córdoba activity/free-tour-cordoba, patio-de-la-juderia-flamenco-dinner, visite-patios and natural-swimming-pools; Granada activity/granada-artisan-crafts, granada-markets-guide and los-cahorros-guided-hike; Dark Skies tours/bryce-canyon-astronomy-festival and bryce-canyon-full-moon-hike (SLA-2998).
13
+
5
14
  ## 0.31.4 (2026-10-08)
6
15
 
7
16
  - No changes; lockstep release with ui and tourism (SLA-3020).
package/README.md CHANGED
@@ -21,7 +21,8 @@ author lookup, public-file check, markdown stripper, publisher policy and route
21
21
  breadcrumb, then each entry's builder in call order, with hooks before and after the entries) and `finalizeGraph`.
22
22
  Builders are factories whose options carry each site's differences, so a site reproduces its current output byte
23
23
  for byte, key order included. It also holds the opening-hours model (`generateOpeningHours`, `parseHoursString`,
24
- `assertedOpenDays`, `hoursStringOpenDays`) that `scripts/validate-opening-hours.mjs` imports. The factory scripts
24
+ `assertedOpenDays`, `hoursStringOpenDays`) that `scripts/validate-opening-hours.mjs` imports, and the display text
25
+ built on the same day resolution (`openingHoursRows`, `openingHoursSummary`, `latestClosing`). The factory scripts
25
26
  load `dist/`; `scripts/lib/core-dist.mjs` rebuilds it when it is missing or older than `src/`.
26
27
 
27
28
  `images` holds the one responsive width ladder (`IMAGE_LADDER`: 160, 240, 320, 480, 640, 960, 1280; WebP only) and the image
@@ -28,7 +28,8 @@ export declare function parseHoursShifts(value: string): Array<{
28
28
  export declare function closedFieldDays(closed: unknown): Set<DayKey>;
29
29
  /**
30
30
  * The day resolution behind `generateOpeningHours`, in emission order: weekdays, weekends, each per-day key,
31
- * then `alwaysOpen`. A per-day key wins over a grouped bucket and every `closed` day is subtracted.
31
+ * then `alwaysOpen`. A per-day key wins over a grouped bucket, `alwaysOpen` covers only the days no other bucket
32
+ * covers (SLA-3023), and every `closed` day is subtracted. The buckets' day sets are disjoint.
32
33
  */
33
34
  export declare function resolveOpeningHours(openingHours: OpeningHoursInput): OpeningHoursBucket[];
34
35
  /**
@@ -38,7 +38,8 @@ export function closedFieldDays(closed) {
38
38
  }
39
39
  /**
40
40
  * The day resolution behind `generateOpeningHours`, in emission order: weekdays, weekends, each per-day key,
41
- * then `alwaysOpen`. A per-day key wins over a grouped bucket and every `closed` day is subtracted.
41
+ * then `alwaysOpen`. A per-day key wins over a grouped bucket, `alwaysOpen` covers only the days no other bucket
42
+ * covers (SLA-3023), and every `closed` day is subtracted. The buckets' day sets are disjoint.
42
43
  */
43
44
  export function resolveOpeningHours(openingHours) {
44
45
  const closed = closedFieldDays(openingHours.closed);
@@ -54,8 +55,10 @@ export function resolveOpeningHours(openingHours) {
54
55
  if (!closed.has(day))
55
56
  buckets.push({ kind: 'day', value: openingHours[day], days: [day] });
56
57
  }
57
- if (openingHours.alwaysOpen)
58
- buckets.push({ kind: 'alwaysOpen', value: openingHours.alwaysOpen, days: groupDays(DAY_KEYS) });
58
+ if (openingHours.alwaysOpen) {
59
+ const covered = new Set(buckets.flatMap((b) => b.days));
60
+ buckets.push({ kind: 'alwaysOpen', value: openingHours.alwaysOpen, days: groupDays(DAY_KEYS).filter((d) => !covered.has(d)) });
61
+ }
59
62
  return buckets;
60
63
  }
61
64
  /**
@@ -0,0 +1,33 @@
1
+ export type OpeningHours = {
2
+ weekdays?: string;
3
+ weekends?: string;
4
+ closed?: string;
5
+ alwaysOpen?: boolean;
6
+ monday?: string;
7
+ tuesday?: string;
8
+ wednesday?: string;
9
+ thursday?: string;
10
+ friday?: string;
11
+ saturday?: string;
12
+ sunday?: string;
13
+ };
14
+ export interface HoursRow {
15
+ label: string;
16
+ value: string;
17
+ }
18
+ /**
19
+ * Rows for a quick-facts list, Monday first, adjacent days sharing a value collapsed into a range ("Wed–Fri").
20
+ * A `closed` string always gets its own trailing row.
21
+ */
22
+ export declare function openingHoursRows(h: OpeningHours | undefined | null): HoursRow[];
23
+ /** One line, "Mon–Fri: 12:00–17:00, Sat–Sun: …", or null when nothing renders. */
24
+ export declare function openingHoursSummary(h: OpeningHours | undefined | null): string | null;
25
+ /**
26
+ * The week's latest closing time and every day that closes then, for a badge like "Open until 07:00 (Fri–Sat)".
27
+ * Never today's close: a static page is served all week. Null when no close parses ("19:00-late") or the venue
28
+ * never closes.
29
+ */
30
+ export declare function latestClosing(h: OpeningHours | undefined | null): {
31
+ time: string;
32
+ label: string;
33
+ } | null;
@@ -0,0 +1,125 @@
1
+ // Reader-facing hours on resolveOpeningHours, the JSON-LD's day resolution; values stay as written (SLA-3023).
2
+ import { DAY_KEYS, HOURS_ALWAYS_OPEN, resolveOpeningHours } from "./hours.js";
3
+ const SHORT = {
4
+ monday: 'Mon', tuesday: 'Tue', wednesday: 'Wed', thursday: 'Thu', friday: 'Fri', saturday: 'Sat', sunday: 'Sun',
5
+ };
6
+ const DAY_INDEX = Object.fromEntries(DAY_KEYS.map((d, i) => [d, i]));
7
+ const HHMM = /^\d{1,2}:\d{2}$/;
8
+ const RANGE_SEP = /\s*[-–]\s*/;
9
+ function displayValue(raw) {
10
+ const v = raw.trim();
11
+ if (v === HOURS_ALWAYS_OPEN)
12
+ return 'Open 24h';
13
+ // Every range of a split-shift value gets an en dash, not only the first.
14
+ return v.replace(/(\d)\s*-\s*(\d)/g, '$1–$2');
15
+ }
16
+ function resolveByDay(h) {
17
+ const byDay = new Map();
18
+ for (const bucket of resolveOpeningHours(h)) {
19
+ const value = bucket.kind === 'alwaysOpen' ? HOURS_ALWAYS_OPEN : String(bucket.value);
20
+ for (const d of bucket.days)
21
+ byDay.set(d, value);
22
+ }
23
+ return byDay;
24
+ }
25
+ const dayRunLabel = (from, to) => (from === to ? SHORT[from] : `${SHORT[from]}–${SHORT[to]}`);
26
+ function collapseDays(days) {
27
+ const parts = [];
28
+ let i = 0;
29
+ while (i < days.length) {
30
+ let j = i;
31
+ while (j + 1 < days.length && DAY_INDEX[days[j + 1]] === DAY_INDEX[days[j]] + 1)
32
+ j++;
33
+ parts.push(dayRunLabel(days[i], days[j]));
34
+ i = j + 1;
35
+ }
36
+ return parts.join(', ');
37
+ }
38
+ /**
39
+ * Rows for a quick-facts list, Monday first, adjacent days sharing a value collapsed into a range ("Wed–Fri").
40
+ * A `closed` string always gets its own trailing row.
41
+ */
42
+ export function openingHoursRows(h) {
43
+ if (!h)
44
+ return [];
45
+ const byDay = resolveByDay(h);
46
+ const rows = [];
47
+ if (h.alwaysOpen && byDay.size === DAY_KEYS.length && [...byDay.values()].every((v) => v === HOURS_ALWAYS_OPEN)) {
48
+ rows.push({ label: 'Hours', value: 'Open 24/7' });
49
+ }
50
+ else {
51
+ const open = DAY_KEYS.filter((d) => byDay.has(d));
52
+ let i = 0;
53
+ while (i < open.length) {
54
+ const value = byDay.get(open[i]);
55
+ // Mon and Wed sharing a value must not collapse to "Mon–Wed" across a closed Tuesday.
56
+ let j = i;
57
+ while (j + 1 < open.length
58
+ && byDay.get(open[j + 1]) === value
59
+ && DAY_INDEX[open[j + 1]] === DAY_INDEX[open[j]] + 1)
60
+ j++;
61
+ rows.push({ label: dayRunLabel(open[i], open[j]), value: displayValue(value) });
62
+ i = j + 1;
63
+ }
64
+ if (rows.length === 1 && open.length === DAY_KEYS.length)
65
+ rows[0].label = 'Daily';
66
+ }
67
+ if (typeof h.closed === 'string' && h.closed.trim()) {
68
+ rows.push({ label: 'Closed', value: h.closed.trim() });
69
+ }
70
+ return rows;
71
+ }
72
+ /** One line, "Mon–Fri: 12:00–17:00, Sat–Sun: …", or null when nothing renders. */
73
+ export function openingHoursSummary(h) {
74
+ const rows = openingHoursRows(h);
75
+ if (rows.length === 0)
76
+ return null;
77
+ if (rows.length === 1 && rows[0].label === 'Hours')
78
+ return rows[0].value;
79
+ return rows.map((r) => `${r.label}: ${r.value}`).join(', ') || null;
80
+ }
81
+ function minutes(hhmm) {
82
+ const [h, m] = hhmm.split(':').map(Number);
83
+ return h * 60 + m;
84
+ }
85
+ // A close at or before its own shift's open has crossed midnight. Not "before 06:00 is tomorrow": that ranks a
86
+ // 22:30-05:00 close above a 22:30-07:00 one.
87
+ function closeRank(open, close) {
88
+ const c = minutes(close);
89
+ if (open && HHMM.test(open))
90
+ return c <= minutes(open) ? c + 1440 : c;
91
+ return c;
92
+ }
93
+ /**
94
+ * The week's latest closing time and every day that closes then, for a badge like "Open until 07:00 (Fri–Sat)".
95
+ * Never today's close: a static page is served all week. Null when no close parses ("19:00-late") or the venue
96
+ * never closes.
97
+ */
98
+ export function latestClosing(h) {
99
+ if (!h)
100
+ return null;
101
+ const byDay = resolveByDay(h);
102
+ let time = null;
103
+ let bestRank = -1;
104
+ let days = [];
105
+ for (const day of DAY_KEYS) {
106
+ const raw = byDay.get(day)?.trim();
107
+ if (!raw || raw === HOURS_ALWAYS_OPEN)
108
+ continue;
109
+ const shifts = raw.split(',').map((s) => s.trim()).filter(Boolean);
110
+ const [open, close] = (shifts[shifts.length - 1] ?? '').split(RANGE_SEP).map((s) => s.trim());
111
+ if (!close || !HHMM.test(close))
112
+ continue;
113
+ const rank = closeRank(open, close);
114
+ if (rank > bestRank) {
115
+ bestRank = rank;
116
+ time = close;
117
+ days = [];
118
+ }
119
+ if (rank === bestRank)
120
+ days.push(day);
121
+ }
122
+ if (!time)
123
+ return null;
124
+ return { time, label: days.length === DAY_KEYS.length ? 'Daily' : collapseDays(days) };
125
+ }
@@ -5,6 +5,8 @@ export type { AddressPolicy, PostalAddressParts } from './values.ts';
5
5
  export { parsePriceRange, calculateAggregatePriceRange } from './price.ts';
6
6
  export { DAY_KEYS, HOURS_ALWAYS_OPEN, parseHoursShifts, closedFieldDays, resolveOpeningHours, assertedOpenDays, generateOpeningHours, parseHoursString, hoursStringOpenDays, } from './hours.ts';
7
7
  export type { DayKey, OpeningHoursInput, OpeningHoursBucket } from './hours.ts';
8
+ export { openingHoursRows, openingHoursSummary, latestClosing } from './hoursDisplay.ts';
9
+ export type { OpeningHours, HoursRow } from './hoursDisplay.ts';
8
10
  export { renderSchemaPolicy } from './policy.ts';
9
11
  export type { SchemaPolicy } from './policy.ts';
10
12
  export { offer, placeNode, siteOrganizationNode, siteWebsiteNode } from './nodes.ts';
@@ -2,6 +2,7 @@ export { createSchemaContext, normalizeHomepageUrl, normalizeStructuredDataUrls,
2
2
  export { parsePriceFromString, isFreeEntry, cleanStreetAddress, normalizePriceRange, normalizeHotelPriceRange, postalCodeOf, dataAddressPolicy, postalAddress, geoCoordinates, aggregateRating, } from "./values.js";
3
3
  export { parsePriceRange, calculateAggregatePriceRange } from "./price.js";
4
4
  export { DAY_KEYS, HOURS_ALWAYS_OPEN, parseHoursShifts, closedFieldDays, resolveOpeningHours, assertedOpenDays, generateOpeningHours, parseHoursString, hoursStringOpenDays, } from "./hours.js";
5
+ export { openingHoursRows, openingHoursSummary, latestClosing } from "./hoursDisplay.js";
5
6
  export { renderSchemaPolicy } from "./policy.js";
6
7
  export { offer, placeNode, siteOrganizationNode, siteWebsiteNode } from "./nodes.js";
7
8
  export { buildBreadcrumbList, buildWebPageNode, assembleGraph, finalizeGraph } from "./graph.js";
@@ -1,6 +1,6 @@
1
1
  import { generateOpeningHours } from "./hours.js";
2
2
  import { offer, placeNode } from "./nodes.js";
3
- import { aggregateRating, geoCoordinates, normalizeHotelPriceRange, parsePriceFromString, postalAddress, postalCodeOf, } from "./values.js";
3
+ import { aggregateRating, geoCoordinates, isFreeEntry, normalizeHotelPriceRange, postalAddress, postalCodeOf, } from "./values.js";
4
4
  /** Hotel at route `hotel`; no `openingHours` means open around the clock. */
5
5
  export function hotelBuilder(options) {
6
6
  const { address, defaultCheckinTime = '14:00', defaultCheckoutTime = '12:00' } = options;
@@ -33,7 +33,7 @@ export function activityBuilder(options) {
33
33
  address: postalAddress(address, data, { street: data.address || data.meetingPoint, postalCode: postalCodeOf(data) }),
34
34
  geo: geoCoordinates(data.coordinates),
35
35
  touristType,
36
- isAccessibleForFree: parsePriceFromString(data.price) === 0,
36
+ isAccessibleForFree: isFreeEntry(data),
37
37
  publicAccess: true,
38
38
  availableLanguage: data.languages || defaultLanguages,
39
39
  telephone: data.phone,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sarimarcus/content-sites-core",
3
- "version": "0.31.4",
3
+ "version": "0.31.6",
4
4
  "description": "Non-visual utilities, Astro config builders and SEO schema assembly shared by the content sites.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -63,7 +63,8 @@ export function closedFieldDays(closed: unknown): Set<DayKey> {
63
63
 
64
64
  /**
65
65
  * The day resolution behind `generateOpeningHours`, in emission order: weekdays, weekends, each per-day key,
66
- * then `alwaysOpen`. A per-day key wins over a grouped bucket and every `closed` day is subtracted.
66
+ * then `alwaysOpen`. A per-day key wins over a grouped bucket, `alwaysOpen` covers only the days no other bucket
67
+ * covers (SLA-3023), and every `closed` day is subtracted. The buckets' day sets are disjoint.
67
68
  */
68
69
  export function resolveOpeningHours(openingHours: OpeningHoursInput): OpeningHoursBucket[] {
69
70
  const closed = closedFieldDays(openingHours.closed);
@@ -77,7 +78,10 @@ export function resolveOpeningHours(openingHours: OpeningHoursInput): OpeningHou
77
78
  for (const day of perDayKeys) {
78
79
  if (!closed.has(day)) buckets.push({ kind: 'day', value: openingHours[day], days: [day] });
79
80
  }
80
- if (openingHours.alwaysOpen) buckets.push({ kind: 'alwaysOpen', value: openingHours.alwaysOpen, days: groupDays(DAY_KEYS) });
81
+ if (openingHours.alwaysOpen) {
82
+ const covered = new Set(buckets.flatMap((b) => b.days));
83
+ buckets.push({ kind: 'alwaysOpen', value: openingHours.alwaysOpen, days: groupDays(DAY_KEYS).filter((d) => !covered.has(d)) });
84
+ }
81
85
  return buckets;
82
86
  }
83
87
 
@@ -0,0 +1,145 @@
1
+ // Reader-facing hours on resolveOpeningHours, the JSON-LD's day resolution; values stay as written (SLA-3023).
2
+ import { DAY_KEYS, HOURS_ALWAYS_OPEN, resolveOpeningHours, type DayKey } from './hours.ts';
3
+
4
+ export type OpeningHours = {
5
+ weekdays?: string;
6
+ weekends?: string;
7
+ closed?: string;
8
+ alwaysOpen?: boolean;
9
+ monday?: string;
10
+ tuesday?: string;
11
+ wednesday?: string;
12
+ thursday?: string;
13
+ friday?: string;
14
+ saturday?: string;
15
+ sunday?: string;
16
+ };
17
+
18
+ export interface HoursRow {
19
+ label: string;
20
+ value: string;
21
+ }
22
+
23
+ const SHORT: Record<DayKey, string> = {
24
+ monday: 'Mon', tuesday: 'Tue', wednesday: 'Wed', thursday: 'Thu', friday: 'Fri', saturday: 'Sat', sunday: 'Sun',
25
+ };
26
+ const DAY_INDEX = Object.fromEntries(DAY_KEYS.map((d, i) => [d, i])) as Record<DayKey, number>;
27
+ const HHMM = /^\d{1,2}:\d{2}$/;
28
+ const RANGE_SEP = /\s*[-–]\s*/;
29
+
30
+ function displayValue(raw: string): string {
31
+ const v = raw.trim();
32
+ if (v === HOURS_ALWAYS_OPEN) return 'Open 24h';
33
+ // Every range of a split-shift value gets an en dash, not only the first.
34
+ return v.replace(/(\d)\s*-\s*(\d)/g, '$1–$2');
35
+ }
36
+
37
+ function resolveByDay(h: OpeningHours): Map<DayKey, string> {
38
+ const byDay = new Map<DayKey, string>();
39
+ for (const bucket of resolveOpeningHours(h)) {
40
+ const value = bucket.kind === 'alwaysOpen' ? HOURS_ALWAYS_OPEN : String(bucket.value);
41
+ for (const d of bucket.days) byDay.set(d, value);
42
+ }
43
+ return byDay;
44
+ }
45
+
46
+ const dayRunLabel = (from: DayKey, to: DayKey) => (from === to ? SHORT[from] : `${SHORT[from]}–${SHORT[to]}`);
47
+
48
+ function collapseDays(days: DayKey[]): string {
49
+ const parts: string[] = [];
50
+ let i = 0;
51
+ while (i < days.length) {
52
+ let j = i;
53
+ while (j + 1 < days.length && DAY_INDEX[days[j + 1]] === DAY_INDEX[days[j]] + 1) j++;
54
+ parts.push(dayRunLabel(days[i], days[j]));
55
+ i = j + 1;
56
+ }
57
+ return parts.join(', ');
58
+ }
59
+
60
+ /**
61
+ * Rows for a quick-facts list, Monday first, adjacent days sharing a value collapsed into a range ("Wed–Fri").
62
+ * A `closed` string always gets its own trailing row.
63
+ */
64
+ export function openingHoursRows(h: OpeningHours | undefined | null): HoursRow[] {
65
+ if (!h) return [];
66
+ const byDay = resolveByDay(h);
67
+ const rows: HoursRow[] = [];
68
+
69
+ if (h.alwaysOpen && byDay.size === DAY_KEYS.length && [...byDay.values()].every((v) => v === HOURS_ALWAYS_OPEN)) {
70
+ rows.push({ label: 'Hours', value: 'Open 24/7' });
71
+ } else {
72
+ const open = DAY_KEYS.filter((d) => byDay.has(d));
73
+ let i = 0;
74
+ while (i < open.length) {
75
+ const value = byDay.get(open[i]) as string;
76
+ // Mon and Wed sharing a value must not collapse to "Mon–Wed" across a closed Tuesday.
77
+ let j = i;
78
+ while (
79
+ j + 1 < open.length
80
+ && byDay.get(open[j + 1]) === value
81
+ && DAY_INDEX[open[j + 1]] === DAY_INDEX[open[j]] + 1
82
+ ) j++;
83
+ rows.push({ label: dayRunLabel(open[i], open[j]), value: displayValue(value) });
84
+ i = j + 1;
85
+ }
86
+ if (rows.length === 1 && open.length === DAY_KEYS.length) rows[0].label = 'Daily';
87
+ }
88
+
89
+ if (typeof h.closed === 'string' && h.closed.trim()) {
90
+ rows.push({ label: 'Closed', value: h.closed.trim() });
91
+ }
92
+ return rows;
93
+ }
94
+
95
+ /** One line, "Mon–Fri: 12:00–17:00, Sat–Sun: …", or null when nothing renders. */
96
+ export function openingHoursSummary(h: OpeningHours | undefined | null): string | null {
97
+ const rows = openingHoursRows(h);
98
+ if (rows.length === 0) return null;
99
+ if (rows.length === 1 && rows[0].label === 'Hours') return rows[0].value;
100
+ return rows.map((r) => `${r.label}: ${r.value}`).join(', ') || null;
101
+ }
102
+
103
+ function minutes(hhmm: string): number {
104
+ const [h, m] = hhmm.split(':').map(Number);
105
+ return h * 60 + m;
106
+ }
107
+
108
+ // A close at or before its own shift's open has crossed midnight. Not "before 06:00 is tomorrow": that ranks a
109
+ // 22:30-05:00 close above a 22:30-07:00 one.
110
+ function closeRank(open: string | undefined, close: string): number {
111
+ const c = minutes(close);
112
+ if (open && HHMM.test(open)) return c <= minutes(open) ? c + 1440 : c;
113
+ return c;
114
+ }
115
+
116
+ /**
117
+ * The week's latest closing time and every day that closes then, for a badge like "Open until 07:00 (Fri–Sat)".
118
+ * Never today's close: a static page is served all week. Null when no close parses ("19:00-late") or the venue
119
+ * never closes.
120
+ */
121
+ export function latestClosing(h: OpeningHours | undefined | null): { time: string; label: string } | null {
122
+ if (!h) return null;
123
+ const byDay = resolveByDay(h);
124
+ let time: string | null = null;
125
+ let bestRank = -1;
126
+ let days: DayKey[] = [];
127
+
128
+ for (const day of DAY_KEYS) {
129
+ const raw = byDay.get(day)?.trim();
130
+ if (!raw || raw === HOURS_ALWAYS_OPEN) continue;
131
+ const shifts = raw.split(',').map((s) => s.trim()).filter(Boolean);
132
+ const [open, close] = (shifts[shifts.length - 1] ?? '').split(RANGE_SEP).map((s) => s.trim());
133
+ if (!close || !HHMM.test(close)) continue;
134
+ const rank = closeRank(open, close);
135
+ if (rank > bestRank) {
136
+ bestRank = rank;
137
+ time = close;
138
+ days = [];
139
+ }
140
+ if (rank === bestRank) days.push(day);
141
+ }
142
+
143
+ if (!time) return null;
144
+ return { time, label: days.length === DAY_KEYS.length ? 'Daily' : collapseDays(days) };
145
+ }
@@ -18,6 +18,8 @@ export {
18
18
  generateOpeningHours, parseHoursString, hoursStringOpenDays,
19
19
  } from './hours.ts';
20
20
  export type { DayKey, OpeningHoursInput, OpeningHoursBucket } from './hours.ts';
21
+ export { openingHoursRows, openingHoursSummary, latestClosing } from './hoursDisplay.ts';
22
+ export type { OpeningHours, HoursRow } from './hoursDisplay.ts';
21
23
  export { renderSchemaPolicy } from './policy.ts';
22
24
  export type { SchemaPolicy } from './policy.ts';
23
25
  export { offer, placeNode, siteOrganizationNode, siteWebsiteNode } from './nodes.ts';
@@ -1,7 +1,7 @@
1
1
  import { generateOpeningHours } from './hours.ts';
2
2
  import { offer, placeNode } from './nodes.ts';
3
3
  import {
4
- aggregateRating, geoCoordinates, normalizeHotelPriceRange, parsePriceFromString, postalAddress, postalCodeOf,
4
+ aggregateRating, geoCoordinates, isFreeEntry, normalizeHotelPriceRange, postalAddress, postalCodeOf,
5
5
  type AddressPolicy,
6
6
  } from './values.ts';
7
7
  import type { SchemaBuilder } from './types.ts';
@@ -55,7 +55,7 @@ export function activityBuilder(options: ActivityOptions): SchemaBuilder {
55
55
  address: postalAddress(address, data, { street: data.address || data.meetingPoint, postalCode: postalCodeOf(data) }),
56
56
  geo: geoCoordinates(data.coordinates),
57
57
  touristType,
58
- isAccessibleForFree: parsePriceFromString(data.price) === 0,
58
+ isAccessibleForFree: isFreeEntry(data),
59
59
  publicAccess: true,
60
60
  availableLanguage: data.languages || defaultLanguages,
61
61
  telephone: data.phone,