<template>
  <span>{{ formattedDate }}</span>
</template>
<script>
import dayjs from 'dayjs';
import advancedFormat from 'dayjs/plugin/advancedFormat';
dayjs.extend(advancedFormat);

export default {
  name: 'BcDateDisplay',
  props: {
    date: {
      type: [String, Date]
    },
    format: {
      type: String, default: 'MM/DD/YYYY'
    }
  },
  computed: {
    formattedDate() {
      if (this.date) {
        return dayjs(new Date(this.date)).format(this.format);
      }
    }
  }
};
</script>
