forked from AMDmi3/opening_hours.js
-
Notifications
You must be signed in to change notification settings - Fork 130
Expand file tree
/
Copy pathsimple_index.html
More file actions
38 lines (30 loc) · 1.62 KB
/
simple_index.html
File metadata and controls
38 lines (30 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html lang="en">
<head>
<title>Simple page using opening_hours.js</title>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/svg+xml" href="https://openingh.openstreetmap.de/evaluation_tool/img/favicon.svg">
<script src="https://openingh.openstreetmap.de/opening_hours.js/opening_hours+deps.min.js"></script>
</head>
<body>
<h1>Nothing to see here, open a debug console in your browser to see the interesting stuff.</h1>
<script>
// Input string (English and German mixed) - intentionally using mixed languages to demonstrate prettification.
let input_value = "Mo-Tu,Do-Fr 10:00-20:00; Samstag und Sonntag geschlossen";
// Language for the warnings (get it from the browser settings).
let locale = navigator.language;
// Create opening_hours object.
let oh = new opening_hours(input_value, {}, { locale: locale });
// Prettify the value in different languages.
let prettified_value_de = oh.prettifyValue({ conf: { locale: "de" } });
let prettified_value_en = oh.prettifyValue({ conf: { locale: "en" } });
let prettified_value_ru = oh.prettifyValue({ conf: { locale: "ru" } });
// Console outputs.
console.log(`Input value (German and English mixed): ${input_value}`);
console.log(`Prettified value (de): ${prettified_value_de}`);
console.log(`Prettified value (en): ${prettified_value_en}`);
console.log(`Prettified value (ru): ${prettified_value_ru}`);
console.log(`Warnings:\n ${oh.getWarnings().join("\n ")}`);
</script>
</body>
</html>