Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:adhesive_bandage: Fixes clock date update delay at midnight (#402)

Alicia Sykes8b1282c5e102
diff --git a/src/components/Widgets/Clock.vue b/src/components/Widgets/Clock.vue
index d4aa0aea..aa5ccc51 100644
--- a/src/components/Widgets/Clock.vue
+++ b/src/components/Widgets/Clock.vue
@@ -15,9 +15,9 @@ export default {
mixins: [WidgetMixin],
data() {
return {
- timeUpdateInterval: null, // Stores setInterval function
time: null, // Current time string
date: null, // Current date string
+ timeUpdateInterval: null, // Stores setInterval function
};
},
computed: {
@@ -61,16 +61,11 @@ export default {
created() {
// Set initial date and time
this.update();
- // Update the date every hour, and the time each second
- this.timeUpdateInterval = setInterval(() => {
- this.setTime();
- const now = new Date();
- if (now.getMinutes() === 0 && now.getSeconds() === 0) {
- this.setDate();
- }
- }, 1000);
+ // Update the time and date every second (1000 ms)
+ this.timeUpdateInterval = setInterval(this.update, 1000);
},
beforeDestroy() {
+ // Remove the clock interval listener
clearInterval(this.timeUpdateInterval);
},
};
@@ -102,6 +97,7 @@ export default {
font-size: 4rem;
padding: 0.5rem;
text-align: center;
+ font-variant-numeric: tabular-nums;
font-family: Digital, var(--font-monospace);
}
}