This commit is contained in:
2026-01-18 13:34:25 +00:00
parent c8fefe3c05
commit eb8f9da8a3

View File

@@ -1,22 +1,22 @@
<script setup> <script setup>
// Get the current date and time, make time reactive
// Get the month name, weekday name and time should be hh:mm:ss
import { ref } from "vue"; import { ref } from "vue";
const date = new Date(); cost time = ref("")
const day = date.getDate(); cost weekday = ref("")
const time = ref( cost day = ref("")
date.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" }), cost month = ref("")
);
const weekday = date.toLocaleDateString("en-GB", { weekday: "long" });
const month = date.toLocaleDateString("en-GB", { month: "long" });
setInterval(() => { function updateDateTime() {
time.value = date.toLocaleTimeString("en-GB", { const date = new Date();
hour: "2-digit", day.value = date.getDate();
minute: "2-digit", time.value = date.toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" })
}); weekday.value = date.toLocaleDateString("en-GB", { weekday: "long" });
}, 1000); month.value = date.toLocaleDateString("en-GB", { month: "long" });
}
updateDateTime();
setInterval(updateDateTime, 60000);
</script> </script>
<template> <template>