Skip to content

Commit

Permalink
Indicate current day with color and text.
Browse files Browse the repository at this point in the history
  • Loading branch information
manud99 committed Oct 6, 2023
1 parent 00c24e2 commit 8ceb317
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ function getEntriesForDay(day: number): TimeEntry[] {
<div
:class="[
'flex flex-wrap justify-between',
'text-xs font-semibold tracking-wide text-left text-gray-500 uppercase',
'border-b bg-gray-50 p-2 md:px-4 md:py-3',
'text-xs font-semibold tracking-wide text-left uppercase',
'border-b p-2 md:px-4 md:py-3',
getDateOfDay(day).isToday() ? 'bg-green-200 text-gray-600' : 'bg-gray-50 text-gray-500',
]"
>
<div>{{ getDateOfDay(day).getFullDate() }}</div>
<div>
{{ getDateOfDay(day).getFullDate() }}
<span v-if="getDateOfDay(day).isToday()">– Heute</span>
</div>
<div>Total: {{ getHoursOfDay(day) }}</div>
</div>
<div v-for="entry in getEntriesForDay(day)">
Expand Down
4 changes: 4 additions & 0 deletions src/utils/CustomDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export default class CustomDate {
);
}

isToday(): boolean {
return this.isOnSameDay(CustomDate.now());
}

isSmallerThan(other: CustomDate): boolean {
return this.date.valueOf() < other.date.valueOf();
}
Expand Down

0 comments on commit 8ceb317

Please sign in to comment.