-
Notifications
You must be signed in to change notification settings - Fork 0
/
relative-time.html
117 lines (109 loc) · 4.51 KB
/
relative-time.html
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>intl-relative-time demo</title>
<style>
html { font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji; }
p > span, p > intl-relative-time { display: block }
intl-relative-time { font-weight: bold; }
</style>
</head>
<body>
<h1>intl-relative-time demo</h1>
<button onclick="i18next.changeLanguage(navigator.language)">locale</button>
<button onclick="i18next.changeLanguage('en-GB')">en-GB</button>
<button onclick="i18next.changeLanguage('fr')">fr</button>
<button onclick="i18next.changeLanguage('ar')">ar</button>
<button onclick="i18next.changeLanguage('zh-CN')">zh-CN</button>
<p>
<span><intl-relative-time></span>
<intl-relative-time></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="1" unit="minute" update></span>
<intl-relative-time value="1" unit="minute" update></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="2020-05-01" update></span>
<intl-relative-time value="2020-05-01" update></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="-1" unit="day"></span>
<intl-relative-time value="-1" unit="day"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="1234" unit="seconds"></span>
<intl-relative-time value="1234" unit="seconds"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="-1" unit="day" lng="it"></span>
<intl-relative-time value="-1" unit="day" lng="it"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="1234" unit="seconds" lng="fr"></span>
<intl-relative-time value="1234" unit="seconds" lng="fr"></intl-relative-time>
</p>
<hr>
<p>
<span><intl-relative-time value="-1" unit="week" styleProp="long" numeric="always" lng="en"></span>
<intl-relative-time value="-1" unit="week" styleProp="long" numeric="always"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="0" unit="week" styleProp="long" numeric="always"></span>
<intl-relative-time value="0" unit="week" styleProp="long" numeric="always"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="1" unit="week" styleProp="long" numeric="always"></span>
<intl-relative-time value="1" unit="week" styleProp="long" numeric="always"></intl-relative-time>
</p>
<hr>
<p>
<span><intl-relative-time value="0" numeric="auto"></span>
<intl-relative-time value="0" numeric="auto"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="-1" unit="day" numeric="auto"></span>
<intl-relative-time value="-1" unit="day" numeric="auto"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="0" unit="day" numeric="auto"></span>
<intl-relative-time value="0" unit="day" numeric="auto"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="1" unit="day" numeric="auto"></span>
<intl-relative-time value="1" unit="day" numeric="auto"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="-1" unit="week" numeric="auto"></span>
<intl-relative-time value="-1" unit="week" numeric="auto"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="0" unit="week" numeric="auto" lng="en></span>
<intl-relative-time value="0" unit="week" numeric="auto"></intl-relative-time>
</p>
<p>
<span><intl-relative-time value="1" unit="week" numeric="auto"></span>
<intl-relative-time value="1" unit="week" numeric="auto"></intl-relative-time>
</p>
<hr>
<p>
<span><intl-relative-time value="2020-01-01"></span>
<intl-relative-time value="2020-01-01"></intl-relative-time>
</p>
<!-- intl-relative-time works also without i18next -->
<script src="https://unpkg.com/i18next@19/i18next.min.js"></script>
<!-- polyfill for safari and locale data -->
<script src="https://unpkg.com/intl-relative-time-format"></script>
<script src="https://unpkg.com/intl-relative-time-format/locale-data/en"></script>
<script src="https://unpkg.com/intl-relative-time-format/locale-data/fr"></script>
<script src="https://unpkg.com/intl-relative-time-format/locale-data/ar"></script>
<script src="https://unpkg.com/intl-relative-time-format/locale-data/zh"></script>
<script src="https://unpkg.com/i18next-wc/dist/intl-relative-time.js"></script>
<!-- <script src="../dist/intl-relative-time.js"></script> -->
<script>
i18next.init()
</script>
<script src="iframeheight.js"></script>
</body>
</html>