feat: qalendar typing

This commit is contained in:
opbnq-q
2025-03-11 05:22:41 -07:00
parent a130fb9063
commit 5c372e8029
5 changed files with 58 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import { Qalendar } from "qalendar";
import { CalendarEvent } from "./event.class";
const config = {
month: {
@@ -9,10 +10,14 @@ const config = {
defaultMode: 'month',
isSilent: true,
};
defineProps<{
events: CalendarEvent[]
}>()
</script>
<template>
<Qalendar :config></Qalendar>
<Qalendar :config :events></Qalendar>
</template>
<style>

View File

@@ -0,0 +1,29 @@
import { toSimpleDateString } from "../../utils/date/converters.util"
export class CalendarEvent {
id: string
title: string
description: string
color: "red" | "yellow" | "blue"
with?: string
time: { start: string; end: string }
constructor(
title: string,
description: string,
timeStart: Date,
timeEnd: Date,
withPerson?: string,
color: "red" | "yellow" | "blue" = "red"
) {
this.title = title
this.description = description
this.time = {
start: toSimpleDateString(timeStart),
end: toSimpleDateString(timeEnd),
}
this.with = withPerson
this.color = color
this.id = new Date().getTime().toString()
}
}