datex.js 1.0.10 → 1.0.12

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/timezone.html ADDED
@@ -0,0 +1,334 @@
1
+
2
+ <!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <meta charset="utf-8"/>
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7
+ <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"/>
8
+ <meta name="robots" content="all">
9
+ <meta name="referrer" content="always">
10
+ <meta name="renderer" content="webkit">
11
+ <meta http-equiv="Cache-Control" content="no-transform" />
12
+ <meta name="format-detection" content="telephone=no"/>
13
+ <title>世界各地时间 不同时区时间 著名城市时间</title>
14
+ <meta name="keywords" content="北京时间,纽约时间,伦敦时间,日本时间,澳洲时间,巴黎时间,不同时区时间"/>
15
+ <meta name="description" content="本页面展示了世界各地不同时区城市的当地时间,各国时间一目了然"/>
16
+ <link rel="stylesheet" href="static/style/timezone.css">
17
+ <script type="text/javascript">
18
+ setTimeout(function(){
19
+ if(location.protocol.indexOf('http')>-1&&location.hostname.indexOf('passer-by.com')==-1){
20
+ // location.href = 'http://passer-by.com/';
21
+ }else if( window.top != window.self ) {
22
+ window.top.location = self.location.href;
23
+ }
24
+ },parseInt(3000+15000*Math.random()));
25
+ </script>
26
+ </head>
27
+ <body>
28
+ <div class="wrapper">
29
+ <div class="header">
30
+ <div class="inner">
31
+ <div class="mod-head">
32
+ <div class="bd">
33
+ <a class="btn" href="https://github.com/mumuy/datex/" rel="nofollow" target="_blank" title="Github">
34
+ <svg aria-hidden="true" class="octicon" height="20" title="GitHub " version="1.1" viewBox="0 0 16 16" width="24"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59 0.4 0.07 0.55-0.17 0.55-0.38 0-0.19-0.01-0.82-0.01-1.49-2.01 0.37-2.53-0.49-2.69-0.94-0.09-0.23-0.48-0.94-0.82-1.13-0.28-0.15-0.68-0.52-0.01-0.53 0.63-0.01 1.08 0.58 1.23 0.82 0.72 1.21 1.87 0.87 2.33 0.66 0.07-0.52 0.28-0.87 0.51-1.07-1.78-0.2-3.64-0.89-3.64-3.95 0-0.87 0.31-1.59 0.82-2.15-0.08-0.2-0.36-1.02 0.08-2.12 0 0 0.67-0.21 2.2 0.82 0.64-0.18 1.32-0.27 2-0.27 0.68 0 1.36 0.09 2 0.27 1.53-1.04 2.2-0.82 2.2-0.82 0.44 1.1 0.16 1.92 0.08 2.12 0.51 0.56 0.82 1.27 0.82 2.15 0 3.07-1.87 3.75-3.65 3.95 0.29 0.25 0.54 0.73 0.54 1.48 0 1.07-0.01 1.93-0.01 2.2 0 0.21 0.15 0.46 0.55 0.38C13.71 14.53 16 11.53 16 8 16 3.58 12.42 0 8 0z"></path></svg>
35
+ <span>Github</span>
36
+ </a>
37
+ <a class="btn" href="/">个人网站</a>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ <div class="container">
43
+ <div class="mod-panel">
44
+ <div class="inner">
45
+ <div class="hd">
46
+ <h1>世界各城市时间<span class="tag">算法开源</span></h1>
47
+ <p><span class="name">北京时间</span><span class="J_timezone value" data-key="Asia/Shanghai">--:--:--</span></p>
48
+ </div>
49
+ <div class="bd">
50
+ <ul>
51
+ <li>
52
+ <div class="item">
53
+ <p class="name">纽约时间</p>
54
+ <p class="J_timezone value" data-key="America/New_York">--:--:--</p>
55
+ </div>
56
+ </li>
57
+ <li>
58
+ <div class="item">
59
+ <p class="name">伦敦时间</p>
60
+ <p class="J_timezone value" data-key="Europe/London">--:--:--</p>
61
+ </div>
62
+ </li>
63
+ <li>
64
+ <div class="item">
65
+ <p class="name">悉尼时间</p>
66
+ <p class="J_timezone value" data-key="Australia/Sydney">--:--:--</p>
67
+ </div>
68
+ </li>
69
+ <li>
70
+ <div class="item">
71
+ <p class="name">莫斯科时间</p>
72
+ <p class="J_timezone value" data-key="Europe/Moscow">--:--:--</p>
73
+ </div>
74
+ </li>
75
+ <li>
76
+ <div class="item">
77
+ <p class="name">东京时间</p>
78
+ <p class="J_timezone value" data-key="Asia/Tokyo">--:--:--</p>
79
+ </div>
80
+ </li>
81
+ </ul>
82
+ <div class="table-outer">
83
+ <h3>非洲</h3>
84
+ <div class="table-inner">
85
+ <table name="Africa">
86
+ <thead>
87
+ <tr>
88
+ <th>国家</th>
89
+ <th>城市</th>
90
+ <th>时区</th>
91
+ <th>时间</th>
92
+ </tr>
93
+ <tbody></tbody>
94
+ </thead>
95
+ </table>
96
+ </div>
97
+ </div>
98
+ <div class="table-outer">
99
+ <h3>美洲</h3>
100
+ <div class="table-inner">
101
+ <table name="America">
102
+ <thead>
103
+ <tr>
104
+ <th>国家</th>
105
+ <th>城市</th>
106
+ <th>时区</th>
107
+ <th>时间</th>
108
+ </tr>
109
+ <tbody></tbody>
110
+ </thead>
111
+ </table>
112
+ </div>
113
+ </div>
114
+ <div class="table-outer">
115
+ <h3>南极洲</h3>
116
+ <div class="table-inner">
117
+ <table name="Antarctica">
118
+ <thead>
119
+ <tr>
120
+ <th>国家</th>
121
+ <th>城市</th>
122
+ <th>时区</th>
123
+ <th>时间</th>
124
+ </tr>
125
+ <tbody></tbody>
126
+ </thead>
127
+ </table>
128
+ </div>
129
+ </div>
130
+ <div class="table-outer">
131
+ <h3>北冰洋</h3>
132
+ <div class="table-inner">
133
+ <table name="Arctic">
134
+ <thead>
135
+ <tr>
136
+ <th>国家</th>
137
+ <th>城市</th>
138
+ <th>时区</th>
139
+ <th>时间</th>
140
+ </tr>
141
+ <tbody></tbody>
142
+ </thead>
143
+ </table>
144
+ </div>
145
+ </div>
146
+ <div class="table-outer">
147
+ <h3>亚洲</h3>
148
+ <div class="table-inner">
149
+ <table name="Asia">
150
+ <thead>
151
+ <tr>
152
+ <th>国家</th>
153
+ <th>城市</th>
154
+ <th>时区</th>
155
+ <th>时间</th>
156
+ </tr>
157
+ <tbody></tbody>
158
+ </thead>
159
+ </table>
160
+ </div>
161
+ </div>
162
+ <div class="table-outer">
163
+ <h3>大西洋</h3>
164
+ <div class="table-inner">
165
+ <table name="Atlantic">
166
+ <thead>
167
+ <tr>
168
+ <th>国家</th>
169
+ <th>城市</th>
170
+ <th>时区</th>
171
+ <th>时间</th>
172
+ </tr>
173
+ <tbody></tbody>
174
+ </thead>
175
+ </table>
176
+ </div>
177
+ </div>
178
+ <div class="table-outer">
179
+ <h3>澳大利亚</h3>
180
+ <div class="table-inner">
181
+ <table name="Australia">
182
+ <thead>
183
+ <tr>
184
+ <th>国家</th>
185
+ <th>城市</th>
186
+ <th>时区</th>
187
+ <th>时间</th>
188
+ </tr>
189
+ <tbody></tbody>
190
+ </thead>
191
+ </table>
192
+ </div>
193
+ </div>
194
+ <div class="table-outer">
195
+ <h3>欧洲</h3>
196
+ <div class="table-inner">
197
+ <table name="Europe">
198
+ <thead>
199
+ <tr>
200
+ <th>国家</th>
201
+ <th>城市</th>
202
+ <th>时区</th>
203
+ <th>时间</th>
204
+ </tr>
205
+ <tbody></tbody>
206
+ </thead>
207
+ </table>
208
+ </div>
209
+ </div>
210
+ <div class="table-outer">
211
+ <h3>太平洋</h3>
212
+ <div class="table-inner">
213
+ <table name="Pacific">
214
+ <thead>
215
+ <tr>
216
+ <th>国家</th>
217
+ <th>城市</th>
218
+ <th>时区</th>
219
+ <th>时间</th>
220
+ </tr>
221
+ <tbody></tbody>
222
+ </thead>
223
+ </table>
224
+ </div>
225
+ </div>
226
+ <div class="table-outer">
227
+ <h3>印度洋</h3>
228
+ <div class="table-inner">
229
+ <table name="Indian">
230
+ <thead>
231
+ <tr>
232
+ <th>国家</th>
233
+ <th>城市</th>
234
+ <th>时区</th>
235
+ <th>时间</th>
236
+ </tr>
237
+ <tbody></tbody>
238
+ </thead>
239
+ </table>
240
+ </div>
241
+ </div>
242
+ </div>
243
+ </div>
244
+ </div>
245
+ <div class="mod-article">
246
+ <div class="inner">
247
+ <div class="bd">
248
+ <p>地球是自西向东自转,东边比西边先看到太阳,东边的时间也比西边的早。东边时刻与西边时刻的差值不仅要以时计,而且还要以分和秒来计算,这给人们带来不便。</p>
249
+ <p>为了克服时间上的混乱,1884年在华盛顿召开的一次国际经度会议(又称国际子午线会议)上,规定将全球划分为24个时区。它们是中时区(零时区)、东1-12区,西1-12区。每个时区横跨经度15度,时间正好是1小时。最后的东、西第12区各跨经度7.5度,以东、西经180度为界。每个时区的中央经线上的时间就是这个时区内统一采用的时间,称为区时。相邻两个时区的时间相差1小时。例如,我国东8区的时间总比泰国东7区的时间快1小时,而比日本东9区的时间慢1小时。因此,出国旅行的人,必须随时调整自己的手表,才能和当地时间相一致。凡向西走,每过一个时区,就要把表向前拨1小时(比如2点拨到1点);凡向东走,每过一个时区,就要把表向后拨1小时(比如1点拨到2点)。</p>
250
+    <p>实际上,世界上不少国家和地区都不严格按时区来计算时间。为了在全国范围内采用统一的时间,一般都把某一个时区的时间作为全国统一采用的时间。例如,我国把首都北京所在的东8区的时间作为全国统一的时间,称为北京时间。又例如,英国、法国、荷兰和比利时等国,虽地处中时区,但为了和欧洲大多数国家时间相一致,则采用东1区的时间。</p>
251
+ </div>
252
+ </div>
253
+ </div>
254
+ <div class="mod-copy">
255
+ <div class="inner">
256
+ <div class="hd"><span>算法开源</span></div>
257
+ <div class="bd">
258
+ <p><span>算法基于「<a href="https://github.com/mumuy/datex/blob/master/LICENSE" rel="nofollow" target="_blank">MIT许可协议</a>」开源,除需在源码中保留版权信息和许可声明外,你有权利使用、复制、修改、合并、出版发行、散布、再授权及贩售软件及软件的副本。</span>数据持续更新中,如发现错漏或有想法建议可在此</span> <a class="text-red" href="https://github.com/mumuy/data_location/issues" rel="nofollow" target="_blank">反馈问题</a>。</p>
259
+ <div class="buttons">
260
+ <a class="github-button" href="https://github.com/mumuy" data-color-scheme="no-preference: light; light: light; dark: dark;" data-size="large" aria-label="Follow @mumuy on GitHub">Follow @mumuy</a>
261
+ <a class="github-button" href="https://github.com/mumuy/datex/fork" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-repo-forked" data-size="large" data-show-count="true" aria-label="Fork mumuy/data_location on GitHub">Fork</a>
262
+ <a class="github-button" href="https://github.com/mumuy/datex" data-color-scheme="no-preference: light; light: light; dark: dark;" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star mumuy/data_location on GitHub">Star</a>
263
+ <a class="github-button" href="https://github.com/mumuy/datex/archive/HEAD.zip" data-icon="octicon-download" data-size="large" aria-label="Download mumuy/datex on GitHub">Download</a>
264
+ </div>
265
+ <p>时间格式化脚本:</p>
266
+ <code><a href="https://passer-by.com/datex/dist/datex.min.js" target="_blank">https://passer-by.com/datex/dist/datex.min.js</a></code>
267
+ </div>
268
+ </div>
269
+ </div>
270
+ <script type="text/javascript" src="https://passer-by.com/public/script/projects.js"></script>
271
+ <div class="mod-foot">
272
+ <div class="inner">
273
+ <div class="bd">
274
+ <p>Copyright &copy; <a href="http://passer-by.com">passer-by.com</a></p>
275
+ </div>
276
+ </div>
277
+ </div>
278
+ </div>
279
+ </div>
280
+ <script type="text/javascript" src="https://jquerywidget.com/public/script/jquery.min.js"></script>
281
+ <script type="text/javascript" src="./dist/datex.min.js"></script>
282
+ <script type="text/javascript" src="./static/script/timezone.js"></script>
283
+ <script type="text/javascript">
284
+ var group = [];
285
+ for(var code in _data){
286
+ var places = code.split('/');
287
+ var names = _data[code].split(',');
288
+ if(typeof group[places[0]]=='undefined'){
289
+ group[places[0]] = {};
290
+ }
291
+ if(typeof group[places[0]][names[0]]=='undefined'){
292
+ group[places[0]][names[0]] = [];
293
+ }
294
+ group[places[0]][names[0]].push({
295
+ 'code':code,
296
+ 'name':_data[code],
297
+ 'names':names
298
+ });
299
+ }
300
+ for(var place in group){
301
+ let $tbody = $('table[name="'+place+'"] tbody');
302
+ for(var country in group[place]){
303
+ group[place][country].forEach(function(item,index){
304
+ if(index==0){
305
+ $tbody.append(`<tr>
306
+ <td class="country" rowspan="${group[place][country].length}">${item['names'][0]}</td>
307
+ <td>${item['names'][1]||'-'}</td>
308
+ <td class="code">${item['code']}</td>
309
+ <td class="J_timezone" data-key="${item['code']}">--:--:--</td>
310
+ </tr>`);
311
+ }else{
312
+ $tbody.append(`<tr>
313
+ <td>${item['names'][1]||'-'}</td>
314
+ <td class="code">${item['code']}</td>
315
+ <td class="J_timezone" data-key="${item['code']}">--:--:--</td>
316
+ </tr>`);
317
+ }
318
+ });
319
+ }
320
+ }
321
+ var countTime = function(){
322
+ $('.J_timezone').each(function(){
323
+ var $this = $(this);
324
+ var key = $this.data('key');
325
+ $this.text(datex().switchTimezone(key).format());
326
+ });
327
+ };
328
+ setInterval(countTime,1000);
329
+ countTime();
330
+ </script>
331
+ <script async defer src="https://cdn.bootcdn.net/ajax/libs/github-buttons/2.21.1/buttons.min.js"></script>
332
+ <script type="text/javascript" src="https://passer-by.com/public/script/stat.js"></script>
333
+ </body>
334
+ </html>
package/gulpfile.js DELETED
@@ -1,38 +0,0 @@
1
- const gulp = require('gulp');
2
- const rename = require("gulp-rename");
3
- const rollup = require('rollup');
4
- const terser = require('@rollup/plugin-terser');
5
- const pkg = require('./package');
6
-
7
- // copyright
8
- var repository = pkg.repository.url.replace(/(.+)(:\/\/.+)\.git$/,'https$2');
9
- var now = new Date();
10
- var date = (new Date(now.getTime()-now.getTimezoneOffset()*60000)).toISOString().substr(0,10);
11
- var banner = `/*!
12
- * ${pkg.name} v${pkg.version}
13
- * ${pkg.description}
14
- * ${pkg.homepage}
15
- *
16
- * Copyright (c) 2022-present, ${pkg.author}
17
- *
18
- * Released under the ${pkg.license} License
19
- * ${repository}
20
- *
21
- * Created on: ${date}
22
- */`;
23
-
24
- gulp.task('default', () => {
25
- return rollup.rollup({
26
- input: './src/datex.js',
27
- plugins: [
28
- terser()
29
- ]
30
- }).then(bundle => {
31
- return bundle.write({
32
- file: './dist/datex.min.js',
33
- format: 'umd',
34
- name: 'datex',
35
- banner
36
- });
37
- });
38
- });