Skip to content

Commit

Permalink
migrate timezones-list lib to @vvo/tzdb issue #4479 (#4521)
Browse files Browse the repository at this point in the history
  • Loading branch information
huzaifaazim0 authored Mar 3, 2024
1 parent 4c683da commit 8fd713d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
13 changes: 6 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"@grpc/grpc-js": "~1.7.3",
"@louislam/ping": "~0.4.4-mod.1",
"@louislam/sqlite3": "15.1.6",
"@vvo/tzdb": "^6.125.0",
"args-parser": "~1.3.0",
"axios": "~0.28.0",
"axios-ntlm": "1.3.0",
Expand Down Expand Up @@ -189,7 +190,6 @@
"stylelint-config-standard": "~25.0.0",
"terser": "~5.15.0",
"test": "~3.3.0",
"timezones-list": "~3.0.1",
"typescript": "~4.4.4",
"v-pagination-3": "~0.1.7",
"vite": "~5.0.10",
Expand Down
15 changes: 8 additions & 7 deletions src/util-frontend.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dayjs from "dayjs";
import timezones from "timezones-list";
import { getTimeZones } from "@vvo/tzdb";
import { localeDirection, currentLocale } from "./i18n";
import { POSITION } from "vue-toastification";

Expand Down Expand Up @@ -29,18 +29,19 @@ function getTimezoneOffset(timeZone) {
*/
export function timezoneList() {
let result = [];
const timeZones = getTimeZones();

for (let timezone of timezones) {
for (let timezone of timeZones) {
try {
let display = dayjs().tz(timezone.tzCode).format("Z");
let display = dayjs().tz(timezone.name).format("Z");

result.push({
name: `(UTC${display}) ${timezone.tzCode}`,
value: timezone.tzCode,
time: getTimezoneOffset(timezone.tzCode),
name: `(UTC${display}) ${timezone.name}`,
value: timezone.name,
time: getTimezoneOffset(timezone.name),
});
} catch (e) {
// Skipping not supported timezone.tzCode by dayjs
// Skipping not supported timezone.name by dayjs
}
}

Expand Down

0 comments on commit 8fd713d

Please sign in to comment.