<template>
    <tb-opening-times-parser
        v-if="marker.detail.openingTimes"
        :opening-times-definition="marker.detail.openingTimes.definitions"
        :opening-times-format="marker.detail.openingTimes.format"
    >
        <template v-slot="{ openingTimes }">
            <p>
                <tb-opening-times-line-preview
                    :opening-times="openingTimes"
                    :date-format="lang.openingTimes.dateFormat"
                    :language-labels="lang.openingTimes || {}"
                />
            </p>
        </template>
    </tb-opening-times-parser>
    <div v-else />
</template>

<script>

/**
 * The TbOpeningTimesParser component is not imported here on purpose because it breaks
 * with the current dependencies in some projects. Possible reasons are conflicting versions
 * of core-js (v2 vs. v3), babel-runtime, etc.
 */
export default {
    name: 'TbInfoWindowOpeningTimes',
    props: {
        marker: { type: Object, required: true },
        lang: { type: Object, required: true },
    },
};
</script>
