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 #picker disabled="false"></mat-datepicker>
</mat-form-field>
<mat-form-field style="display:contents;">
<input matInput #time type="time" placeholder="choose a time">
</mat-form-field>
</div>
<div mat-dialog-actions>
<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>

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