added time picker for events

master
Max 5 years ago
parent 506b33f5a8
commit ad04096f15

@ -8,8 +8,11 @@
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle> <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker disabled="false"></mat-datepicker> <mat-datepicker #picker disabled="false"></mat-datepicker>
</mat-form-field> </mat-form-field>
<mat-form-field style="display:contents;">
<input matInput #time type="time" placeholder="choose a time">
</mat-form-field>
</div> </div>
<div mat-dialog-actions> <div mat-dialog-actions>
<button mat-button (click)="onNoClick()">Cancel</button> <button mat-button (click)="onNoClick()">Cancel</button>
<button mat-button cdkFocusInitial (click)="createEvent(name.value, date.value)">Create Event</button> <button mat-button cdkFocusInitial (click)="createEvent(name.value, date.value, time.value)">Create Event</button>
</div> </div>

@ -28,11 +28,14 @@ export class DialogCreateEventComponent {
this.dialogRef.close(); this.dialogRef.close();
} }
createEvent(name: string, date: string) { createEvent(name: string, date: string, time: string) {
name = name.trim(); name = name.trim();
if (name && date) { if (name && date && time) {
this.group.createEvent(name, (new Date(date)).getTime().toString(), this.groupId); date = date + ' ' + time;
this.dialogRef.close(); console.log(date);
console.log(new Date(date).getTime().toString());
this.group.createEvent(name, (new Date(date)).getTime().toString(), this.groupId);
this.dialogRef.close();
} }
} }

Loading…
Cancel
Save