Move timezones to npm package and convert util-frontend.js to typescript
This commit is contained in:
		
							parent
							
								
									6d7cb44acc
								
							
						
					
					
						commit
						a7674755ba
					
				
					 5 changed files with 214 additions and 421 deletions
				
			
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							|  | @ -7,4 +7,5 @@ dist-ssr | |||
| 
 | ||||
| /data | ||||
| !/data/.gitkeep | ||||
| .vscode | ||||
| /uptime-kuma | ||||
| .vscode | ||||
|  |  | |||
							
								
								
									
										173
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										173
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							|  | @ -1,12 +1,12 @@ | |||
| { | ||||
|     "name": "uptime-kuma", | ||||
|     "version": "1.5.2", | ||||
|     "version": "1.6.0", | ||||
|     "lockfileVersion": 2, | ||||
|     "requires": true, | ||||
|     "packages": { | ||||
|         "": { | ||||
|             "name": "uptime-kuma", | ||||
|             "version": "1.5.2", | ||||
|             "version": "1.6.0", | ||||
|             "license": "MIT", | ||||
|             "dependencies": { | ||||
|                 "@fortawesome/fontawesome-svg-core": "^1.2.36", | ||||
|  | @ -37,6 +37,7 @@ | |||
|                 "socket.io-client": "^4.2.0", | ||||
|                 "sqlite3": "github:mapbox/node-sqlite3#593c9d", | ||||
|                 "tcp-ping": "^0.1.1", | ||||
|                 "timezones-list": "^3.0.1", | ||||
|                 "v-pagination-3": "^0.1.6", | ||||
|                 "vue": "^3.2.8", | ||||
|                 "vue-chart-3": "^0.5.7", | ||||
|  | @ -4460,6 +4461,7 @@ | |||
|             "version": "3.1.25", | ||||
|             "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", | ||||
|             "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", | ||||
|             "dev": true, | ||||
|             "bin": { | ||||
|                 "nanoid": "bin/nanoid.cjs" | ||||
|             }, | ||||
|  | @ -6307,6 +6309,7 @@ | |||
|         "node_modules/sqlite3": { | ||||
|             "version": "5.0.2", | ||||
|             "resolved": "git+ssh://git@github.com/mapbox/node-sqlite3.git#593c9d498be2510d286349134537e3bf89401c4a", | ||||
|             "integrity": "sha512-jUoUHizVh+QCulAEPid3qxX+TunsNMDFDC3TdB/+33OEx8Ud3IhbfrXU+MNnhAR9p4Sk5X93LkoXure8VVGrQA==", | ||||
|             "hasInstallScript": true, | ||||
|             "license": "BSD-3-Clause", | ||||
|             "dependencies": { | ||||
|  | @ -6933,6 +6936,11 @@ | |||
|                 "node": ">=8" | ||||
|             } | ||||
|         }, | ||||
|         "node_modules/timezones-list": { | ||||
|             "version": "3.0.1", | ||||
|             "resolved": "https://registry.npmjs.org/timezones-list/-/timezones-list-3.0.1.tgz", | ||||
|             "integrity": "sha512-yfOzyuVwzgD0LkldD3Epkr+JUdUIxEUL147Fa6ZgG/23KU28iOv3e3M7vQOCFMPyopAhDX7dqOLWttIP7tkTKg==" | ||||
|         }, | ||||
|         "node_modules/to-fast-properties": { | ||||
|             "version": "2.0.0", | ||||
|             "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", | ||||
|  | @ -7310,6 +7318,64 @@ | |||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         "node_modules/vue-chart-3/node_modules/@vue/reactivity": { | ||||
|             "version": "3.2.11", | ||||
|             "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.11.tgz", | ||||
|             "integrity": "sha512-hEQstxPQbgGZq5qApzrvbDmRdK1KP96O/j4XrwT8fVkT1ytkFs4fH2xNEh9QKwXfybbQkLs77W7OfXCv5o6qbA==", | ||||
|             "dependencies": { | ||||
|                 "@vue/shared": "3.2.11" | ||||
|             } | ||||
|         }, | ||||
|         "node_modules/vue-chart-3/node_modules/@vue/runtime-core": { | ||||
|             "version": "3.2.11", | ||||
|             "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.2.11.tgz", | ||||
|             "integrity": "sha512-horlxjWwSvModC87WdsWswzzHE5IexmKkQA65S5vFgP5hLUBW+HRyScDeuB/RRcFmqnf+ozacNCfap0kqcpODw==", | ||||
|             "dependencies": { | ||||
|                 "@vue/reactivity": "3.2.11", | ||||
|                 "@vue/shared": "3.2.11" | ||||
|             } | ||||
|         }, | ||||
|         "node_modules/vue-chart-3/node_modules/@vue/runtime-dom": { | ||||
|             "version": "3.2.11", | ||||
|             "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.2.11.tgz", | ||||
|             "integrity": "sha512-cOK1g0INdiCbds2xrrJKrrN+pDHuLz6esUs/crdEiupDuX7IeiMbdqrAQCkYHp5P1KLWcbGlkmwfVD7HQGii0Q==", | ||||
|             "dependencies": { | ||||
|                 "@vue/runtime-core": "3.2.11", | ||||
|                 "@vue/shared": "3.2.11", | ||||
|                 "csstype": "^2.6.8" | ||||
|             } | ||||
|         }, | ||||
|         "node_modules/vue-chart-3/node_modules/@vue/runtime-dom/node_modules/csstype": { | ||||
|             "version": "2.6.17", | ||||
|             "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.17.tgz", | ||||
|             "integrity": "sha512-u1wmTI1jJGzCJzWndZo8mk4wnPTZd1eOIYTYvuEyOQGfmDl3TrabCCfKnOC86FZwW/9djqTl933UF/cS425i9A==" | ||||
|         }, | ||||
|         "node_modules/vue-chart-3/node_modules/@vue/shared": { | ||||
|             "version": "3.2.11", | ||||
|             "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.11.tgz", | ||||
|             "integrity": "sha512-ovfXAsSsCvV9JVceWjkqC/7OF5HbgLOtCWjCIosmPGG8lxbPuavhIxRH1dTx4Dg9xLgRTNLvI3pVxG4ItQZekg==" | ||||
|         }, | ||||
|         "node_modules/vue-chart-3/node_modules/csstype": { | ||||
|             "version": "3.0.8", | ||||
|             "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.8.tgz", | ||||
|             "integrity": "sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==" | ||||
|         }, | ||||
|         "node_modules/vue-chart-3/node_modules/lodash": { | ||||
|             "version": "4.17.21", | ||||
|             "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", | ||||
|             "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" | ||||
|         }, | ||||
|         "node_modules/vue-chart-3/node_modules/nanoid": { | ||||
|             "version": "3.1.25", | ||||
|             "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", | ||||
|             "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", | ||||
|             "bin": { | ||||
|                 "nanoid": "bin/nanoid.cjs" | ||||
|             }, | ||||
|             "engines": { | ||||
|                 "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" | ||||
|             } | ||||
|         }, | ||||
|         "node_modules/vue-confirm-dialog": { | ||||
|             "version": "1.0.2", | ||||
|             "resolved": "https://registry.npmjs.org/vue-confirm-dialog/-/vue-confirm-dialog-1.0.2.tgz", | ||||
|  | @ -7974,7 +8040,8 @@ | |||
|         "@fortawesome/vue-fontawesome": { | ||||
|             "version": "3.0.0-4", | ||||
|             "resolved": "https://registry.npmjs.org/@fortawesome/vue-fontawesome/-/vue-fontawesome-3.0.0-4.tgz", | ||||
|             "integrity": "sha512-dQVhhMRcUPCb0aqk5ohm0KGk5OJ7wFZ9aYapLzJB3Z+xs7LhkRWLTb87reelUAG5PFDjutDAXuloT9hi6cz72A==" | ||||
|             "integrity": "sha512-dQVhhMRcUPCb0aqk5ohm0KGk5OJ7wFZ9aYapLzJB3Z+xs7LhkRWLTb87reelUAG5PFDjutDAXuloT9hi6cz72A==", | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "@humanwhocodes/config-array": { | ||||
|             "version": "0.5.0", | ||||
|  | @ -8368,7 +8435,8 @@ | |||
|             "version": "1.6.0", | ||||
|             "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.6.0.tgz", | ||||
|             "integrity": "sha512-n3i8htn8pTg9M+kM3cnEfsPZx/6ngInlTroth6fA1LQTJq5aTVQ8ggaE5pPoAy9vCgHPtcaXMzwpldhqRAkebQ==", | ||||
|             "dev": true | ||||
|             "dev": true, | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "@vue/compiler-core": { | ||||
|             "version": "3.2.8", | ||||
|  | @ -8501,7 +8569,8 @@ | |||
|             "version": "5.3.2", | ||||
|             "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", | ||||
|             "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", | ||||
|             "dev": true | ||||
|             "dev": true, | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "agent-base": { | ||||
|             "version": "6.0.2", | ||||
|  | @ -8856,7 +8925,8 @@ | |||
|         "bootstrap": { | ||||
|             "version": "5.1.0", | ||||
|             "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.0.tgz", | ||||
|             "integrity": "sha512-bs74WNI9BgBo3cEovmdMHikSKoXnDgA6VQjJ7TyTotU6L7d41ZyCEEelPwkYEzsG/Zjv3ie9IE3EMAje0W9Xew==" | ||||
|             "integrity": "sha512-bs74WNI9BgBo3cEovmdMHikSKoXnDgA6VQjJ7TyTotU6L7d41ZyCEEelPwkYEzsG/Zjv3ie9IE3EMAje0W9Xew==", | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "brace-expansion": { | ||||
|             "version": "1.1.11", | ||||
|  | @ -8970,7 +9040,8 @@ | |||
|         "chartjs-adapter-dayjs": { | ||||
|             "version": "1.0.0", | ||||
|             "resolved": "https://registry.npmjs.org/chartjs-adapter-dayjs/-/chartjs-adapter-dayjs-1.0.0.tgz", | ||||
|             "integrity": "sha512-EnbVqTJGFKLpg1TROLdCEufrzbmIa2oeLGx8O2Wdjw2EoMudoOo9+YFu+6CM0Z0hQ/v3yq/e/Y6efQMu22n8Jg==" | ||||
|             "integrity": "sha512-EnbVqTJGFKLpg1TROLdCEufrzbmIa2oeLGx8O2Wdjw2EoMudoOo9+YFu+6CM0Z0hQ/v3yq/e/Y6efQMu22n8Jg==", | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "chokidar": { | ||||
|             "version": "3.5.2", | ||||
|  | @ -10262,7 +10333,8 @@ | |||
|             "version": "5.1.0", | ||||
|             "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", | ||||
|             "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", | ||||
|             "dev": true | ||||
|             "dev": true, | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "ignore": { | ||||
|             "version": "4.0.6", | ||||
|  | @ -10989,7 +11061,8 @@ | |||
|         "nanoid": { | ||||
|             "version": "3.1.25", | ||||
|             "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", | ||||
|             "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==" | ||||
|             "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", | ||||
|             "dev": true | ||||
|         }, | ||||
|         "natural-compare": { | ||||
|             "version": "1.4.0", | ||||
|  | @ -11463,7 +11536,8 @@ | |||
|             "version": "3.0.0", | ||||
|             "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", | ||||
|             "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", | ||||
|             "dev": true | ||||
|             "dev": true, | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "postcss-modules-local-by-default": { | ||||
|             "version": "4.0.0", | ||||
|  | @ -11782,7 +11856,8 @@ | |||
|             "version": "0.36.2", | ||||
|             "resolved": "https://registry.npmjs.org/postcss-syntax/-/postcss-syntax-0.36.2.tgz", | ||||
|             "integrity": "sha512-nBRg/i7E3SOHWxF3PpF5WnJM/jQ1YpY9000OaVXlAQj6Zp/kIqJxEDWIZ67tAd7NLuk7zqN4yqe9nc0oNAOs1w==", | ||||
|             "dev": true | ||||
|             "dev": true, | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "postcss-value-parser": { | ||||
|             "version": "4.1.0", | ||||
|  | @ -12678,7 +12753,8 @@ | |||
|             "version": "5.0.0", | ||||
|             "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-5.0.0.tgz", | ||||
|             "integrity": "sha512-c8aubuARSu5A3vEHLBeOSJt1udOdS+1iue7BmJDTSXoCBmfEQmmWX+59vYIj3NQdJBY6a/QRv1ozVFpaB9jaqA==", | ||||
|             "dev": true | ||||
|             "dev": true, | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "stylelint-config-standard": { | ||||
|             "version": "22.0.0", | ||||
|  | @ -12899,6 +12975,11 @@ | |||
|             "resolved": "https://registry.npmjs.org/tildify/-/tildify-2.0.0.tgz", | ||||
|             "integrity": "sha512-Cc+OraorugtXNfs50hU9KS369rFXCfgGLpfCfvlc+Ud5u6VWmUQsOAa9HbTvheQdYnrdJqqv1e5oIqXppMYnSw==" | ||||
|         }, | ||||
|         "timezones-list": { | ||||
|             "version": "3.0.1", | ||||
|             "resolved": "https://registry.npmjs.org/timezones-list/-/timezones-list-3.0.1.tgz", | ||||
|             "integrity": "sha512-yfOzyuVwzgD0LkldD3Epkr+JUdUIxEUL147Fa6ZgG/23KU28iOv3e3M7vQOCFMPyopAhDX7dqOLWttIP7tkTKg==" | ||||
|         }, | ||||
|         "to-fast-properties": { | ||||
|             "version": "2.0.0", | ||||
|             "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", | ||||
|  | @ -13176,17 +13257,75 @@ | |||
|                 "lodash": "latest", | ||||
|                 "nanoid": "latest", | ||||
|                 "vue-demi": "^0.10.1" | ||||
|             }, | ||||
|             "dependencies": { | ||||
|                 "@vue/reactivity": { | ||||
|                     "version": "3.2.11", | ||||
|                     "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.11.tgz", | ||||
|                     "integrity": "sha512-hEQstxPQbgGZq5qApzrvbDmRdK1KP96O/j4XrwT8fVkT1ytkFs4fH2xNEh9QKwXfybbQkLs77W7OfXCv5o6qbA==", | ||||
|                     "requires": { | ||||
|                         "@vue/shared": "3.2.11" | ||||
|                     } | ||||
|                 }, | ||||
|                 "@vue/runtime-core": { | ||||
|                     "version": "3.2.11", | ||||
|                     "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.2.11.tgz", | ||||
|                     "integrity": "sha512-horlxjWwSvModC87WdsWswzzHE5IexmKkQA65S5vFgP5hLUBW+HRyScDeuB/RRcFmqnf+ozacNCfap0kqcpODw==", | ||||
|                     "requires": { | ||||
|                         "@vue/reactivity": "3.2.11", | ||||
|                         "@vue/shared": "3.2.11" | ||||
|                     } | ||||
|                 }, | ||||
|                 "@vue/runtime-dom": { | ||||
|                     "version": "3.2.11", | ||||
|                     "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.2.11.tgz", | ||||
|                     "integrity": "sha512-cOK1g0INdiCbds2xrrJKrrN+pDHuLz6esUs/crdEiupDuX7IeiMbdqrAQCkYHp5P1KLWcbGlkmwfVD7HQGii0Q==", | ||||
|                     "requires": { | ||||
|                         "@vue/runtime-core": "3.2.11", | ||||
|                         "@vue/shared": "3.2.11", | ||||
|                         "csstype": "^2.6.8" | ||||
|                     }, | ||||
|                     "dependencies": { | ||||
|                         "csstype": { | ||||
|                             "version": "2.6.17", | ||||
|                             "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.17.tgz", | ||||
|                             "integrity": "sha512-u1wmTI1jJGzCJzWndZo8mk4wnPTZd1eOIYTYvuEyOQGfmDl3TrabCCfKnOC86FZwW/9djqTl933UF/cS425i9A==" | ||||
|                         } | ||||
|                     } | ||||
|                 }, | ||||
|                 "@vue/shared": { | ||||
|                     "version": "3.2.11", | ||||
|                     "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.11.tgz", | ||||
|                     "integrity": "sha512-ovfXAsSsCvV9JVceWjkqC/7OF5HbgLOtCWjCIosmPGG8lxbPuavhIxRH1dTx4Dg9xLgRTNLvI3pVxG4ItQZekg==" | ||||
|                 }, | ||||
|                 "csstype": { | ||||
|                     "version": "3.0.8", | ||||
|                     "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.8.tgz", | ||||
|                     "integrity": "sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==" | ||||
|                 }, | ||||
|                 "lodash": { | ||||
|                     "version": "4.17.21", | ||||
|                     "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", | ||||
|                     "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" | ||||
|                 }, | ||||
|                 "nanoid": { | ||||
|                     "version": "3.1.25", | ||||
|                     "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", | ||||
|                     "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==" | ||||
|                 } | ||||
|             } | ||||
|         }, | ||||
|         "vue-confirm-dialog": { | ||||
|             "version": "1.0.2", | ||||
|             "resolved": "https://registry.npmjs.org/vue-confirm-dialog/-/vue-confirm-dialog-1.0.2.tgz", | ||||
|             "integrity": "sha512-gTo1bMDWOLd/6ihmWv8VlPxhc9QaKoE5YqlsKydUOfrrQ3Q3taljF6yI+1TMtAtJLrvZ8DYrePhgBhY1VCJzbQ==" | ||||
|             "integrity": "sha512-gTo1bMDWOLd/6ihmWv8VlPxhc9QaKoE5YqlsKydUOfrrQ3Q3taljF6yI+1TMtAtJLrvZ8DYrePhgBhY1VCJzbQ==", | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "vue-demi": { | ||||
|             "version": "0.10.1", | ||||
|             "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.10.1.tgz", | ||||
|             "integrity": "sha512-L6Oi+BvmMv6YXvqv5rJNCFHEKSVu7llpWWJczqmAQYOdmPPw5PNYoz1KKS//Fxhi+4QP64dsPjtmvnYGo1jemA==" | ||||
|             "integrity": "sha512-L6Oi+BvmMv6YXvqv5rJNCFHEKSVu7llpWWJczqmAQYOdmPPw5PNYoz1KKS//Fxhi+4QP64dsPjtmvnYGo1jemA==", | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "vue-eslint-parser": { | ||||
|             "version": "7.10.0", | ||||
|  | @ -13249,7 +13388,8 @@ | |||
|         "vue-toastification": { | ||||
|             "version": "2.0.0-rc.1", | ||||
|             "resolved": "https://registry.npmjs.org/vue-toastification/-/vue-toastification-2.0.0-rc.1.tgz", | ||||
|             "integrity": "sha512-hjauv/FyesNZdwcr5m1SCyvu1JmlB+Ts5bTptDLDmsYYlj6Oqv8NYakiElpCF+Abwkn9J/AChh6FwkTL1HOb7Q==" | ||||
|             "integrity": "sha512-hjauv/FyesNZdwcr5m1SCyvu1JmlB+Ts5bTptDLDmsYYlj6Oqv8NYakiElpCF+Abwkn9J/AChh6FwkTL1HOb7Q==", | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "which": { | ||||
|             "version": "2.0.2", | ||||
|  | @ -13294,7 +13434,8 @@ | |||
|         "ws": { | ||||
|             "version": "7.4.6", | ||||
|             "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", | ||||
|             "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==" | ||||
|             "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", | ||||
|             "requires": {} | ||||
|         }, | ||||
|         "xmlhttprequest-ssl": { | ||||
|             "version": "2.0.0", | ||||
|  |  | |||
|  | @ -64,6 +64,7 @@ | |||
|         "socket.io-client": "^4.2.0", | ||||
|         "sqlite3": "github:mapbox/node-sqlite3#593c9d", | ||||
|         "tcp-ping": "^0.1.1", | ||||
|         "timezones-list": "^3.0.1", | ||||
|         "v-pagination-3": "^0.1.6", | ||||
|         "vue": "^3.2.8", | ||||
|         "vue-chart-3": "^0.5.7", | ||||
|  |  | |||
|  | @ -1,404 +0,0 @@ | |||
| import dayjs from "dayjs"; | ||||
| import timezone from "dayjs/plugin/timezone"; | ||||
| import utc from "dayjs/plugin/utc"; | ||||
| 
 | ||||
| dayjs.extend(utc) | ||||
| dayjs.extend(timezone) | ||||
| 
 | ||||
| function getTimezoneOffset(timeZone) { | ||||
|     const now = new Date(); | ||||
|     const tzString = now.toLocaleString("en-US", { | ||||
|         timeZone, | ||||
|     }); | ||||
|     const localString = now.toLocaleString("en-US"); | ||||
|     const diff = (Date.parse(localString) - Date.parse(tzString)) / 3600000; | ||||
|     const offset = diff + now.getTimezoneOffset() / 60; | ||||
|     return -offset; | ||||
| } | ||||
| 
 | ||||
| // From: https://stackoverflow.com/questions/38399465/how-to-get-list-of-all-timezones-in-javascript
 | ||||
| // TODO: Move to separate file
 | ||||
| const aryIannaTimeZones = [ | ||||
|     "Europe/Andorra", | ||||
|     "Asia/Dubai", | ||||
|     "Asia/Kabul", | ||||
|     "Europe/Tirane", | ||||
|     "Asia/Yerevan", | ||||
|     "Antarctica/Casey", | ||||
|     "Antarctica/Davis", | ||||
|     "Antarctica/Mawson", | ||||
|     "Antarctica/Palmer", | ||||
|     "Antarctica/Rothera", | ||||
|     "Antarctica/Syowa", | ||||
|     "Antarctica/Troll", | ||||
|     "Antarctica/Vostok", | ||||
|     "America/Argentina/Buenos_Aires", | ||||
|     "America/Argentina/Cordoba", | ||||
|     "America/Argentina/Salta", | ||||
|     "America/Argentina/Jujuy", | ||||
|     "America/Argentina/Tucuman", | ||||
|     "America/Argentina/Catamarca", | ||||
|     "America/Argentina/La_Rioja", | ||||
|     "America/Argentina/San_Juan", | ||||
|     "America/Argentina/Mendoza", | ||||
|     "America/Argentina/San_Luis", | ||||
|     "America/Argentina/Rio_Gallegos", | ||||
|     "America/Argentina/Ushuaia", | ||||
|     "Pacific/Pago_Pago", | ||||
|     "Europe/Vienna", | ||||
|     "Australia/Lord_Howe", | ||||
|     "Antarctica/Macquarie", | ||||
|     "Australia/Hobart", | ||||
|     "Australia/Currie", | ||||
|     "Australia/Melbourne", | ||||
|     "Australia/Sydney", | ||||
|     "Australia/Broken_Hill", | ||||
|     "Australia/Brisbane", | ||||
|     "Australia/Lindeman", | ||||
|     "Australia/Adelaide", | ||||
|     "Australia/Darwin", | ||||
|     "Australia/Perth", | ||||
|     "Australia/Eucla", | ||||
|     "Asia/Baku", | ||||
|     "America/Barbados", | ||||
|     "Asia/Dhaka", | ||||
|     "Europe/Brussels", | ||||
|     "Europe/Sofia", | ||||
|     "Atlantic/Bermuda", | ||||
|     "Asia/Brunei", | ||||
|     "America/La_Paz", | ||||
|     "America/Noronha", | ||||
|     "America/Belem", | ||||
|     "America/Fortaleza", | ||||
|     "America/Recife", | ||||
|     "America/Araguaina", | ||||
|     "America/Maceio", | ||||
|     "America/Bahia", | ||||
|     "America/Sao_Paulo", | ||||
|     "America/Campo_Grande", | ||||
|     "America/Cuiaba", | ||||
|     "America/Santarem", | ||||
|     "America/Porto_Velho", | ||||
|     "America/Boa_Vista", | ||||
|     "America/Manaus", | ||||
|     "America/Eirunepe", | ||||
|     "America/Rio_Branco", | ||||
|     "America/Nassau", | ||||
|     "Asia/Thimphu", | ||||
|     "Europe/Minsk", | ||||
|     "America/Belize", | ||||
|     "America/St_Johns", | ||||
|     "America/Halifax", | ||||
|     "America/Glace_Bay", | ||||
|     "America/Moncton", | ||||
|     "America/Goose_Bay", | ||||
|     "America/Blanc-Sablon", | ||||
|     "America/Toronto", | ||||
|     "America/Nipigon", | ||||
|     "America/Thunder_Bay", | ||||
|     "America/Iqaluit", | ||||
|     "America/Pangnirtung", | ||||
|     "America/Atikokan", | ||||
|     "America/Winnipeg", | ||||
|     "America/Rainy_River", | ||||
|     "America/Resolute", | ||||
|     "America/Rankin_Inlet", | ||||
|     "America/Regina", | ||||
|     "America/Swift_Current", | ||||
|     "America/Edmonton", | ||||
|     "America/Cambridge_Bay", | ||||
|     "America/Yellowknife", | ||||
|     "America/Inuvik", | ||||
|     "America/Creston", | ||||
|     "America/Dawson_Creek", | ||||
|     "America/Fort_Nelson", | ||||
|     "America/Vancouver", | ||||
|     "America/Whitehorse", | ||||
|     "America/Dawson", | ||||
|     "Indian/Cocos", | ||||
|     "Europe/Zurich", | ||||
|     "Africa/Abidjan", | ||||
|     "Pacific/Rarotonga", | ||||
|     "America/Santiago", | ||||
|     "America/Punta_Arenas", | ||||
|     "Pacific/Easter", | ||||
|     "Asia/Shanghai", | ||||
|     "Asia/Urumqi", | ||||
|     "America/Bogota", | ||||
|     "America/Costa_Rica", | ||||
|     "America/Havana", | ||||
|     "Atlantic/Cape_Verde", | ||||
|     "America/Curacao", | ||||
|     "Indian/Christmas", | ||||
|     "Asia/Nicosia", | ||||
|     "Asia/Famagusta", | ||||
|     "Europe/Prague", | ||||
|     "Europe/Berlin", | ||||
|     "Europe/Copenhagen", | ||||
|     "America/Santo_Domingo", | ||||
|     "Africa/Algiers", | ||||
|     "America/Guayaquil", | ||||
|     "Pacific/Galapagos", | ||||
|     "Europe/Tallinn", | ||||
|     "Africa/Cairo", | ||||
|     "Africa/El_Aaiun", | ||||
|     "Europe/Madrid", | ||||
|     "Africa/Ceuta", | ||||
|     "Atlantic/Canary", | ||||
|     "Europe/Helsinki", | ||||
|     "Pacific/Fiji", | ||||
|     "Atlantic/Stanley", | ||||
|     "Pacific/Chuuk", | ||||
|     "Pacific/Pohnpei", | ||||
|     "Pacific/Kosrae", | ||||
|     "Atlantic/Faroe", | ||||
|     "Europe/Paris", | ||||
|     "Europe/London", | ||||
|     "Asia/Tbilisi", | ||||
|     "America/Cayenne", | ||||
|     "Africa/Accra", | ||||
|     "Europe/Gibraltar", | ||||
|     "America/Godthab", | ||||
|     "America/Danmarkshavn", | ||||
|     "America/Scoresbysund", | ||||
|     "America/Thule", | ||||
|     "Europe/Athens", | ||||
|     "Atlantic/South_Georgia", | ||||
|     "America/Guatemala", | ||||
|     "Pacific/Guam", | ||||
|     "Africa/Bissau", | ||||
|     "America/Guyana", | ||||
|     "Asia/Hong_Kong", | ||||
|     "America/Tegucigalpa", | ||||
|     "America/Port-au-Prince", | ||||
|     "Europe/Budapest", | ||||
|     "Asia/Jakarta", | ||||
|     "Asia/Pontianak", | ||||
|     "Asia/Makassar", | ||||
|     "Asia/Jayapura", | ||||
|     "Europe/Dublin", | ||||
|     "Asia/Jerusalem", | ||||
|     "Asia/Kolkata", | ||||
|     "Indian/Chagos", | ||||
|     "Asia/Baghdad", | ||||
|     "Asia/Tehran", | ||||
|     "Atlantic/Reykjavik", | ||||
|     "Europe/Rome", | ||||
|     "America/Jamaica", | ||||
|     "Asia/Amman", | ||||
|     "Asia/Tokyo", | ||||
|     "Africa/Nairobi", | ||||
|     "Asia/Bishkek", | ||||
|     "Pacific/Tarawa", | ||||
|     "Pacific/Enderbury", | ||||
|     "Pacific/Kiritimati", | ||||
|     "Asia/Pyongyang", | ||||
|     "Asia/Seoul", | ||||
|     "Asia/Almaty", | ||||
|     "Asia/Qyzylorda", | ||||
|     "Asia/Aqtobe", | ||||
|     "Asia/Aqtau", | ||||
|     "Asia/Atyrau", | ||||
|     "Asia/Oral", | ||||
|     "Asia/Beirut", | ||||
|     "Asia/Colombo", | ||||
|     "Africa/Monrovia", | ||||
|     "Europe/Vilnius", | ||||
|     "Europe/Luxembourg", | ||||
|     "Europe/Riga", | ||||
|     "Africa/Tripoli", | ||||
|     "Africa/Casablanca", | ||||
|     "Europe/Monaco", | ||||
|     "Europe/Chisinau", | ||||
|     "Pacific/Majuro", | ||||
|     "Pacific/Kwajalein", | ||||
|     "Asia/Yangon", | ||||
|     "Asia/Ulaanbaatar", | ||||
|     "Asia/Hovd", | ||||
|     "Asia/Choibalsan", | ||||
|     "Asia/Macau", | ||||
|     "America/Martinique", | ||||
|     "Europe/Malta", | ||||
|     "Indian/Mauritius", | ||||
|     "Indian/Maldives", | ||||
|     "America/Mexico_City", | ||||
|     "America/Cancun", | ||||
|     "America/Merida", | ||||
|     "America/Monterrey", | ||||
|     "America/Matamoros", | ||||
|     "America/Mazatlan", | ||||
|     "America/Chihuahua", | ||||
|     "America/Ojinaga", | ||||
|     "America/Hermosillo", | ||||
|     "America/Tijuana", | ||||
|     "America/Bahia_Banderas", | ||||
|     "Asia/Kuala_Lumpur", | ||||
|     "Asia/Kuching", | ||||
|     "Africa/Maputo", | ||||
|     "Africa/Windhoek", | ||||
|     "Pacific/Noumea", | ||||
|     "Pacific/Norfolk", | ||||
|     "Africa/Lagos", | ||||
|     "America/Managua", | ||||
|     "Europe/Amsterdam", | ||||
|     "Europe/Oslo", | ||||
|     "Asia/Kathmandu", | ||||
|     "Pacific/Nauru", | ||||
|     "Pacific/Niue", | ||||
|     "Pacific/Auckland", | ||||
|     "Pacific/Chatham", | ||||
|     "America/Panama", | ||||
|     "America/Lima", | ||||
|     "Pacific/Tahiti", | ||||
|     "Pacific/Marquesas", | ||||
|     "Pacific/Gambier", | ||||
|     "Pacific/Port_Moresby", | ||||
|     "Pacific/Bougainville", | ||||
|     "Asia/Manila", | ||||
|     "Asia/Karachi", | ||||
|     "Europe/Warsaw", | ||||
|     "America/Miquelon", | ||||
|     "Pacific/Pitcairn", | ||||
|     "America/Puerto_Rico", | ||||
|     "Asia/Gaza", | ||||
|     "Asia/Hebron", | ||||
|     "Europe/Lisbon", | ||||
|     "Atlantic/Madeira", | ||||
|     "Atlantic/Azores", | ||||
|     "Pacific/Palau", | ||||
|     "America/Asuncion", | ||||
|     "Asia/Qatar", | ||||
|     "Indian/Reunion", | ||||
|     "Europe/Bucharest", | ||||
|     "Europe/Belgrade", | ||||
|     "Europe/Kaliningrad", | ||||
|     "Europe/Moscow", | ||||
|     "Europe/Simferopol", | ||||
|     "Europe/Kirov", | ||||
|     "Europe/Astrakhan", | ||||
|     "Europe/Volgograd", | ||||
|     "Europe/Saratov", | ||||
|     "Europe/Ulyanovsk", | ||||
|     "Europe/Samara", | ||||
|     "Asia/Yekaterinburg", | ||||
|     "Asia/Omsk", | ||||
|     "Asia/Novosibirsk", | ||||
|     "Asia/Barnaul", | ||||
|     "Asia/Tomsk", | ||||
|     "Asia/Novokuznetsk", | ||||
|     "Asia/Krasnoyarsk", | ||||
|     "Asia/Irkutsk", | ||||
|     "Asia/Chita", | ||||
|     "Asia/Yakutsk", | ||||
|     "Asia/Khandyga", | ||||
|     "Asia/Vladivostok", | ||||
|     "Asia/Ust-Nera", | ||||
|     "Asia/Magadan", | ||||
|     "Asia/Sakhalin", | ||||
|     "Asia/Srednekolymsk", | ||||
|     "Asia/Kamchatka", | ||||
|     "Asia/Anadyr", | ||||
|     "Asia/Riyadh", | ||||
|     "Pacific/Guadalcanal", | ||||
|     "Indian/Mahe", | ||||
|     "Africa/Khartoum", | ||||
|     "Europe/Stockholm", | ||||
|     "Asia/Singapore", | ||||
|     "America/Paramaribo", | ||||
|     "Africa/Juba", | ||||
|     "Africa/Sao_Tome", | ||||
|     "America/El_Salvador", | ||||
|     "Asia/Damascus", | ||||
|     "America/Grand_Turk", | ||||
|     "Africa/Ndjamena", | ||||
|     "Indian/Kerguelen", | ||||
|     "Asia/Bangkok", | ||||
|     "Asia/Dushanbe", | ||||
|     "Pacific/Fakaofo", | ||||
|     "Asia/Dili", | ||||
|     "Asia/Ashgabat", | ||||
|     "Africa/Tunis", | ||||
|     "Pacific/Tongatapu", | ||||
|     "Europe/Istanbul", | ||||
|     "America/Port_of_Spain", | ||||
|     "Pacific/Funafuti", | ||||
|     "Asia/Taipei", | ||||
|     "Europe/Kiev", | ||||
|     "Europe/Uzhgorod", | ||||
|     "Europe/Zaporozhye", | ||||
|     "Pacific/Wake", | ||||
|     "America/New_York", | ||||
|     "America/Detroit", | ||||
|     "America/Kentucky/Louisville", | ||||
|     "America/Kentucky/Monticello", | ||||
|     "America/Indiana/Indianapolis", | ||||
|     "America/Indiana/Vincennes", | ||||
|     "America/Indiana/Winamac", | ||||
|     "America/Indiana/Marengo", | ||||
|     "America/Indiana/Petersburg", | ||||
|     "America/Indiana/Vevay", | ||||
|     "America/Chicago", | ||||
|     "America/Indiana/Tell_City", | ||||
|     "America/Indiana/Knox", | ||||
|     "America/Menominee", | ||||
|     "America/North_Dakota/Center", | ||||
|     "America/North_Dakota/New_Salem", | ||||
|     "America/North_Dakota/Beulah", | ||||
|     "America/Denver", | ||||
|     "America/Boise", | ||||
|     "America/Phoenix", | ||||
|     "America/Los_Angeles", | ||||
|     "America/Anchorage", | ||||
|     "America/Juneau", | ||||
|     "America/Sitka", | ||||
|     "America/Metlakatla", | ||||
|     "America/Yakutat", | ||||
|     "America/Nome", | ||||
|     "America/Adak", | ||||
|     "Pacific/Honolulu", | ||||
|     "America/Montevideo", | ||||
|     "Asia/Samarkand", | ||||
|     "Asia/Tashkent", | ||||
|     "America/Caracas", | ||||
|     "Asia/Ho_Chi_Minh", | ||||
|     "Pacific/Efate", | ||||
|     "Pacific/Wallis", | ||||
|     "Pacific/Apia", | ||||
|     "Africa/Johannesburg", | ||||
| ]; | ||||
| 
 | ||||
| export function timezoneList() { | ||||
| 
 | ||||
|     let result = []; | ||||
| 
 | ||||
|     for (let timezone of aryIannaTimeZones) { | ||||
| 
 | ||||
|         try { | ||||
|             let display = dayjs().tz(timezone).format("Z"); | ||||
| 
 | ||||
|             result.push({ | ||||
|                 name: `(UTC${display}) ${timezone}`, | ||||
|                 value: timezone, | ||||
|                 time: getTimezoneOffset(timezone), | ||||
|             }) | ||||
|         } catch (e) { | ||||
|             console.error(e.message); | ||||
|             console.log("Skip this timezone") | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     result.sort((a, b) => { | ||||
|         if (a.time > b.time) { | ||||
|             return 1; | ||||
|         } | ||||
| 
 | ||||
|         if (b.time > a.time) { | ||||
|             return -1; | ||||
|         } | ||||
| 
 | ||||
|         return 0; | ||||
|     }) | ||||
| 
 | ||||
|     return result; | ||||
| } | ||||
							
								
								
									
										54
									
								
								src/util-frontend.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								src/util-frontend.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,54 @@ | |||
| import * as dayjs from "dayjs"; | ||||
| import * as timezone from "dayjs/plugin/timezone"; | ||||
| import * as utc from "dayjs/plugin/utc"; | ||||
| import timezones from "timezones-list"; | ||||
| 
 | ||||
| dayjs.extend(utc) | ||||
| dayjs.extend(timezone) | ||||
| 
 | ||||
| function getTimezoneOffset(timeZone) { | ||||
|     const now = new Date(); | ||||
|     const tzString = now.toLocaleString("en-US", { | ||||
|         timeZone, | ||||
|     }); | ||||
|     const localString = now.toLocaleString("en-US"); | ||||
|     const diff = (Date.parse(localString) - Date.parse(tzString)) / 3600000; | ||||
|     const offset = diff + now.getTimezoneOffset() / 60; | ||||
|     return -offset; | ||||
| } | ||||
| 
 | ||||
| export function timezoneList() { | ||||
| 
 | ||||
|     let result = []; | ||||
| 
 | ||||
|     for (let timezone of timezones) { | ||||
| 
 | ||||
|         try { | ||||
|             let display = dayjs().tz(timezone.tzCode).format("Z"); | ||||
| 
 | ||||
|             result.push({ | ||||
|                 name: `(UTC${display}) ${timezone.tzCode}`, | ||||
|                 value: timezone.tzCode, | ||||
|                 time: getTimezoneOffset(timezone.tzCode), | ||||
|             }) | ||||
|         } catch (e) { | ||||
|             console.error(e.message); | ||||
|             console.log("Skip this timezone") | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     result.sort((a, b) => { | ||||
|         if (a.time > b.time) { | ||||
|             return 1; | ||||
|         } | ||||
| 
 | ||||
|         if (b.time > a.time) { | ||||
|             return -1; | ||||
|         } | ||||
| 
 | ||||
|         return 0; | ||||
|     }) | ||||
| 
 | ||||
|     return result; | ||||
| } | ||||
		Loading…
	
		Reference in a new issue