diff --git a/src/fullcalendar/localization/localeProvider.js b/src/fullcalendar/localization/localeProvider.js index 150737429..a2f360f67 100644 --- a/src/fullcalendar/localization/localeProvider.js +++ b/src/fullcalendar/localization/localeProvider.js @@ -2,10 +2,7 @@ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { translate as t, getLanguage } from '@nextcloud/l10n' -import { - getFirstDayOfWeekFromMomentLocale, -} from '../../utils/moment.js' +import { translate as t, getLanguage, getFirstDay } from '@nextcloud/l10n' /** * Returns localization settings for the FullCalender package. @@ -15,7 +12,7 @@ import { */ const getFullCalendarLocale = () => { return { - firstDay: getFirstDayOfWeekFromMomentLocale(), + firstDay: getFirstDay(), locale: getLanguage(), // TRANSLATORS W is an abbreviation for Week weekText: t('calendar', 'W'), diff --git a/src/utils/localization.js b/src/utils/localization.js index 4de4bc625..af8f9bf20 100644 --- a/src/utils/localization.js +++ b/src/utils/localization.js @@ -7,6 +7,7 @@ import { getDayNames, getDayNamesMin, getDayNamesShort, + getFirstDay, getMonthNames, getMonthNamesShort, } from '@nextcloud/l10n' @@ -31,7 +32,7 @@ const getLangConfigForVue2DatePicker = (momentLocale) => { weekdays: getDayNames(), weekdaysShort: getDayNamesShort(), weekdaysMin: getDayNamesMin(), - firstDayOfWeek: moment.localeData(momentLocale).firstDayOfWeek(), + firstDayOfWeek: getFirstDay(), firstWeekContainsDate: moment.localeData(momentLocale).firstDayOfYear(), meridiem: moment.localeData(momentLocale).meridiem, meridiemParse: moment.localeData(momentLocale).meridiemParse, diff --git a/src/utils/moment.js b/src/utils/moment.js index 3ef765bd8..7d3aad5b1 100644 --- a/src/utils/moment.js +++ b/src/utils/moment.js @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { getLanguage, getLocale } from '@nextcloud/l10n' +import { getFirstDay, getLanguage, getLocale } from '@nextcloud/l10n' import moment from '@nextcloud/moment' /** @@ -38,7 +38,7 @@ export default async function loadMomentLocalization() { llll: moment.localeData(realLocale).longDateFormat('llll'), }, week: { - dow: moment.localeData(realLocale).firstDayOfWeek(), + dow: getFirstDay(), doy: moment.localeData(realLocale).firstDayOfYear(), }, }) @@ -77,12 +77,3 @@ async function getLocaleFor(locale) { return 'en' } - -/** - * Get's the first day of a week based on a moment locale - * - * @return {number} - */ -export function getFirstDayOfWeekFromMomentLocale() { - return moment.localeData().firstDayOfWeek() -}