Skip to content

Commit

Permalink
Always show entry for today
Browse files Browse the repository at this point in the history
  • Loading branch information
alinnert committed Dec 10, 2023
1 parent 3c0ae37 commit fd5c3d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/DaysList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defineProps<{ items: Date[] }>()
<template>
<div class="flex flex-col gap-1">
<template v-for="(day, index) in items" :key="index">
<DaysListItem :day="day"></DaysListItem>
<DaysListItem :day="day" :class="{ 'font-bold': index === 0 }"></DaysListItem>
</template>
</div>
</template>
8 changes: 8 additions & 0 deletions src/stores/times.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ export const useTimesStore = defineStore('times', () => {
}
}

days.sort()

const today = new Date(currentTime.value.getFullYear(), currentTime.value.getMonth(), currentTime.value.getDate())

if (!isSameDay(days[0], today)) {
days.unshift(today)
}

return days
})

Expand Down

0 comments on commit fd5c3d0

Please sign in to comment.