<!--
template date formatée
-->

<template>
  <span>{{datesFormatted}}</span>
</template>

<script lang="ts">
import { defineComponent, useContext, computed, ComputedRef } from '@nuxtjs/composition-api'
import DatesUtils from '~/services/utils/datesUtils'

export default defineComponent({
  props: {
    data: {
      type: [String, Array],
      required: false,
      default: null
    }
  },
  setup (props) {
    const { $moment } = useContext()
    const dateUtils = new DatesUtils($moment)

    const datesFormatted: ComputedRef<string> = computed(() => {
      return dateUtils.formattedDate(props.data, 'DD/MM/YYYY')
    })

    return {
      datesFormatted
    }
  }
})
</script>
