diff --git a/l10n/messages.pot b/l10n/messages.pot index 01710efedd..26e98f0e55 100644 --- a/l10n/messages.pot +++ b/l10n/messages.pot @@ -211,10 +211,6 @@ msgstr "" msgid "Frequently used" msgstr "" -#. TRANSLATORS: This refers to global timezones in the timezone picker -msgid "Global" -msgstr "" - msgid "Go back to the list" msgstr "" diff --git a/package-lock.json b/package-lock.json index b0edd8fc20..e4b4d58f65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,6 @@ "@nextcloud/logger": "^3.0.2", "@nextcloud/router": "^3.0.1", "@nextcloud/sharing": "^0.3.0", - "@nextcloud/timezones": "^1.0.0", "@vuepic/vue-datepicker": "^11.0.2", "@vueuse/components": "^13.9.0", "@vueuse/core": "^13.9.0", @@ -3523,18 +3522,6 @@ "stylelint-config-recommended-vue": "^1.5.0" } }, - "node_modules/@nextcloud/timezones": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@nextcloud/timezones/-/timezones-1.0.0.tgz", - "integrity": "sha512-9b7Wms2mzB4RAltf8s9dY40PcU5ova5QjQJw1Gty35e54alKyx33BqUOy4gEbkzmYSrW4aZcLcMrOO5Bj2eIzg==", - "license": "AGPL-3.0-or-later", - "dependencies": { - "ical.js": "^2.1.0" - }, - "engines": { - "node": "^20 || ^22" - } - }, "node_modules/@nextcloud/typings": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/@nextcloud/typings/-/typings-1.9.1.tgz", @@ -13457,12 +13444,6 @@ "dev": true, "license": "BSD-3-Clause" }, - "node_modules/ical.js": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ical.js/-/ical.js-2.2.1.tgz", - "integrity": "sha512-yK/UlPbEs316igb/tjRgbFA8ZV75rCsBJp/hWOatpyaPNlgw0dGDmU+FoicOcwX4xXkeXOkYiOmCqNPFpNPkQg==", - "license": "MPL-2.0" - }, "node_modules/iconv-lite": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", diff --git a/package.json b/package.json index 138da927f8..87f25b25b0 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,6 @@ "@nextcloud/logger": "^3.0.2", "@nextcloud/router": "^3.0.1", "@nextcloud/sharing": "^0.3.0", - "@nextcloud/timezones": "^1.0.0", "@vuepic/vue-datepicker": "^11.0.2", "@vueuse/components": "^13.9.0", "@vueuse/core": "^13.9.0", diff --git a/src/components/NcTimezonePicker/NcTimezonePicker.vue b/src/components/NcTimezonePicker/NcTimezonePicker.vue index 02d512f8ed..f453d75f47 100644 --- a/src/components/NcTimezonePicker/NcTimezonePicker.vue +++ b/src/components/NcTimezonePicker/NcTimezonePicker.vue @@ -16,7 +16,7 @@ export default { data() { return { - tz: 'Hawaiian Standard Time', + tz: 'Europe/Berlin', } }, } @@ -25,21 +25,26 @@ export default { diff --git a/src/components/NcTimezonePicker/timezoneDataProviderService.ts b/src/components/NcTimezonePicker/timezoneDataProviderService.ts deleted file mode 100644 index 923391e358..0000000000 --- a/src/components/NcTimezonePicker/timezoneDataProviderService.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -import { getTimezoneManager } from '@nextcloud/timezones' - -const timezoneManager = getTimezoneManager() -let initialized = false - -/** - * Gets the timezone-manager - * initializes it if necessary - */ -export default function() { - if (!initialized) { - timezoneManager.registerDefaultTimezones() - initialized = true - } - - return timezoneManager -} diff --git a/src/components/NcTimezonePicker/timezoneUtils.ts b/src/components/NcTimezonePicker/timezoneUtils.ts new file mode 100644 index 0000000000..709c4fef6d --- /dev/null +++ b/src/components/NcTimezonePicker/timezoneUtils.ts @@ -0,0 +1,34 @@ +/* + * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +/** + * Convert timezone ID in IANA format (e.g. "Europe/Berlin") to a more human-readable format + * + * @param timezoneId - IANA timezone ID (e.g. "America/Argentina/San_Juan") + * @return Formatted timezone string (e.g. "Argentina - San Juan") + */ +function formatTimezoneId(timezoneId: string) { + return timezoneId + // 'America/Argentina/San_Juan' -> 'Argentina/San_Juan' + .slice(timezoneId.indexOf('/') + 1) + // 'Argentina/San_Juan' -> 'Argentina - San_Juan' + .replaceAll('/', ' - ') + // 'San_Juan' -> 'San Juan' + .replaceAll('_', ' ') +} + +/** + * Get a list of supported IANA timezone IDs (e.g. "Europe/Berlin") with human-readable labels, + * excluding Etc/* administrative zones not used by users (see: https://en.wikipedia.org/wiki/Tz_database#Areas) + */ +export function getTimezones() { + return Intl.supportedValuesOf('timeZone') + .filter((tz) => !tz.startsWith('Etc/')) + .map((timezoneId) => ({ + timezoneId, + label: formatTimezoneId(timezoneId), + })) + .sort((a, b) => a.timezoneId.localeCompare(b.timezoneId)) +}