angular2-datetimepicker icon indicating copy to clipboard operation
angular2-datetimepicker copied to clipboard

Not an Issue, but a bug fix for

Open BrunCola opened this issue 7 years ago • 0 comments

So i kept getting an error when i would drag my mouse, and since your setDate function is using evt.target.innerHTML to get the date value, when you would highlight more than one day then click, it would error out. moving the (click) on the td fixed the bug

<table class="calendar-days" (click)="setDay($event);" [hidden]="monthsView || yearView"> <tr *ngFor="let week of monthDays"> <td [ngClass]="{'calendar-day': day.day != null,'today': day == today.getDate() && date?.getMonth() == today.getMonth() && date?.getFullYear() == today.getFullYear(),'selected-day': day.day == date?.getDate()}" *ngFor="let day of week"> <span [attr.data-label]="composeDate(day.date)">day.day</span> </td> </tr> </table>

to

<table class="calendar-days" [hidden]="monthsView || yearView"> <tr *ngFor="let week of monthDays"> <td [ngClass]="{'calendar-day': day.day != null,'today': day == today.getDate() && date?.getMonth() == today.getMonth() && date?.getFullYear() == today.getFullYear(),'selected-day': day.day == date?.getDate()}" *ngFor="let day of week" (click)="setDay($event);"> <span [attr.data-label]="composeDate(day.date)">day.day</span> </td> </tr> </table>

notice I took the (click)="setDay($event);" and put it on the *ngFor loop ...

the error i was always getting was ERROR Error: InvalidPipeArgument: 'Invalid Date' for pipe 'DatePipe' and fixes it for ALL *ngFor in your HTML

BrunCola avatar Jun 16 '18 17:06 BrunCola