refactor: event instances
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { parseCalendarDate } from '@/utils/date'
|
||||
|
||||
const props = defineProps<{
|
||||
event: any | null
|
||||
@@ -11,19 +12,6 @@ const emit = defineEmits<{
|
||||
'click': [event: any]
|
||||
}>()
|
||||
|
||||
const formatDateTime = (isoString: string | null | undefined): string => {
|
||||
if (!isoString) return 'Not set'
|
||||
const date = new Date(isoString)
|
||||
return date.toLocaleString('en-US', {
|
||||
weekday: 'short',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
year: 'numeric',
|
||||
hour: 'numeric',
|
||||
minute: '2-digit'
|
||||
})
|
||||
}
|
||||
|
||||
const formatTime = (isoString: string | null | undefined): string => {
|
||||
if (!isoString) return 'Not set'
|
||||
const date = new Date(isoString)
|
||||
@@ -33,6 +21,10 @@ const formatTime = (isoString: string | null | undefined): string => {
|
||||
})
|
||||
}
|
||||
|
||||
const formatAllDayDate = (isoString: string | null | undefined): string => {
|
||||
return parseCalendarDate(isoString)?.toLocaleDateString() ?? 'Not set'
|
||||
}
|
||||
|
||||
const popupStyle = computed(() => {
|
||||
return {
|
||||
left: `${props.position.x}px`,
|
||||
@@ -83,7 +75,7 @@ const participantCount = computed(() => {
|
||||
<v-icon icon="mdi-clock-outline" size="small" class="mr-2 text-grey" />
|
||||
<div class="text-caption">
|
||||
<div v-if="event.properties?.timeless">
|
||||
All Day - {{ new Date(event.properties.startsOn).toLocaleDateString() }}
|
||||
All Day - {{ formatAllDayDate(event.properties.startsOn) }}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ formatTime(event.properties?.startsOn) }} - {{ formatTime(event.properties?.endsOn) }}
|
||||
|
||||
Reference in New Issue
Block a user