diff --git a/components/Fields/Field.vue b/components/Fields/Field.vue
index 7eee6309..807af690 100644
--- a/components/Fields/Field.vue
+++ b/components/Fields/Field.vue
@@ -10,7 +10,8 @@ import DateRange, { isDateRangeEmpty } from '~/components/Fields/DateRange.vue'
import Facebook from '~/components/Fields/Facebook.vue'
import LinkedIn from '~/components/Fields/LinkedIn.vue'
import Instagram from '~/components/Fields/Instagram.vue'
-import OpeningHours, { isOpeningHoursSupportedOsmTags } from '~/components/Fields/OpeningHours.vue'
+import OpeningHours from '~/components/Fields/OpeningHours.vue'
+import { isOpeningHoursSupportedOsmTags } from '~/composables/useOpeningHours'
import Phone from '~/components/Fields/Phone.vue'
import RoutesField from '~/components/Fields/RoutesField.vue'
import Stars from '~/components/Fields/Stars.vue'
diff --git a/components/Fields/OpeningHours.vue b/components/Fields/OpeningHours.vue
index 7909a4fe..b178d148 100644
--- a/components/Fields/OpeningHours.vue
+++ b/components/Fields/OpeningHours.vue
@@ -1,193 +1,149 @@
-
@@ -195,7 +151,7 @@ export default defineNuxtComponent({
{{ openingHours }}
- {{ $t('openingHours.next') }}
+ {{ t('openingHours.next') }}
{{ $t('openingHours.variableWeek') }}
+{{ t('openingHours.variableWeek') }}
diff --git a/composables/useOpeningHours.ts b/composables/useOpeningHours.ts new file mode 100644 index 00000000..8948a78b --- /dev/null +++ b/composables/useOpeningHours.ts @@ -0,0 +1,21 @@ +export const PointTime = [/^collection_times$/, /^service_times$/] + +// List of tag keys regex copied from opening_hours.js +const SupportedOsmKeys = [ + ...PointTime, + /^opening_hours$/, + /^opening_hours:.+/, + /.+:opening_hours$/, + /.+:opening_hours:.+/, + /^smoking_hours$/, + /^happy_hours$/, + /^lit$/, +] + +export function isSupportedOsmTags(keys: RegExp[], key: string): boolean { + return keys.some(regexKey => regexKey.test(key)) +} + +export function isOpeningHoursSupportedOsmTags(key: string): boolean { + return isSupportedOsmTags(SupportedOsmKeys, key) +}