MOBILE-3068 calendar: Calculate istoday in the app

main
Dani Palou 2019-08-29 11:20:43 +02:00
parent 3920319511
commit 1700f8947d
2 changed files with 4 additions and 1 deletions

View File

@ -39,7 +39,7 @@
<!-- Weeks. --> <!-- Weeks. -->
<ion-row *ngFor="let week of weeks" class="addon-calendar-week"> <ion-row *ngFor="let week of weeks" class="addon-calendar-week">
<ion-col *ngFor="let value of week.prepadding" class="dayblank addon-calendar-day"></ion-col> <!-- Empty slots (first week). --> <ion-col *ngFor="let value of week.prepadding" class="dayblank addon-calendar-day"></ion-col> <!-- Empty slots (first week). -->
<ion-col text-center *ngFor="let day of week.days" (click)="dayClicked(day.mday)" [ngClass]='{"hasevents": day.hasevents, "today": day.istoday, "weekend": day.isweekend, "duration_finish": day.haslastdayofevent}' class="addon-calendar-day" [class.addon-calendar-event-past-day]="isPastMonth || day.ispast"> <ion-col text-center *ngFor="let day of week.days" (click)="dayClicked(day.mday)" [ngClass]='{"hasevents": day.hasevents, "today": isCurrentMonth && day.istoday, "weekend": day.isweekend, "duration_finish": day.haslastdayofevent}' class="addon-calendar-day" [class.addon-calendar-event-past-day]="isPastMonth || day.ispast">
<p class="addon-calendar-day-number"><span>{{ day.mday }}</span></p> <p class="addon-calendar-day-number"><span>{{ day.mday }}</span></p>
<!-- In phone, display some dots to indicate the type of events. --> <!-- In phone, display some dots to indicate the type of events. -->

View File

@ -205,9 +205,12 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest
this.calculateIsCurrentMonth(); this.calculateIsCurrentMonth();
if (this.isCurrentMonth) { if (this.isCurrentMonth) {
const currentDay = new Date().getDate();
let isPast = true; let isPast = true;
this.weeks.forEach((week) => { this.weeks.forEach((week) => {
week.days.some((day) => { week.days.some((day) => {
day.istoday = day.mday == currentDay;
day.ispast = isPast && !day.istoday; day.ispast = isPast && !day.istoday;
isPast = day.ispast; isPast = day.ispast;