migrate timezones-list lib to @vvo/tzdb issue #4479 (#4521)

This commit is contained in:
Huzaifa Azim
2024-03-03 14:54:14 +05:00
committed by GitHub
parent 4c683da0dd
commit 8fd713d642
3 changed files with 15 additions and 15 deletions

View File

@@ -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";
@@ -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
}
}