<template>
  <slot v-if="slot" :display="display" />
  <template v-else>{{ display }}</template>
</template>
<script setup lang="ts">
import {
  useTimestampDisplay,
  type TimestampDisplayConfig,
  type TimestampDisplayType,
} from "../../../plugs/composables";

interface Props extends TimestampDisplayConfig {
  value: string | number;
  type?: TimestampDisplayType;
  slot?: boolean;
}

const props = defineProps<Props>();

const { display } = useTimestampDisplay(() => ({
  value: props.value,
  valueFormat: props.valueFormat,
  valueTz: props.valueTz,
  displayFormat: props.displayFormat,
  locale: props.locale,
  type: props.type,
}));
</script>
