<script>
 export let date;
 export let dateStyle;
 export let timeStyle;

 function formatDate(input, dateStyle, timeStyle) {
     if (typeof input === 'string') {
         input = new Date(input);
     }
     return new Intl.DateTimeFormat(undefined, {
         dateStyle,
         timeStyle,
     }).format(input);
 }
</script>

{formatDate(date, dateStyle, timeStyle)}
