Refactoring betreft date object
This commit is contained in:
@@ -10,7 +10,6 @@ import {
|
||||
TuiTextareaModule,
|
||||
TuiTextfieldControllerModule
|
||||
} from "@taiga-ui/legacy";
|
||||
import {Appointment} from '../../models/appointment';
|
||||
import {TuiDay, TuiValidationError} from '@taiga-ui/cdk';
|
||||
import {AppointmentService} from '../../services/appointment.service';
|
||||
import {TuiDataListWrapperComponent, TuiFilterByInputPipe, TuiStringifyContentPipe} from '@taiga-ui/kit';
|
||||
@@ -75,7 +74,7 @@ export class NewItemComponent implements OnInit {
|
||||
this.appointmentForm.get('startTime').setValue('', Validators.required)
|
||||
this.appointmentForm.get('endTime').setValue('', [Validators.required, timeAfterStartValidator('startTime')])
|
||||
this.appointments.sort((a, b) => {
|
||||
return a.startHour - b.startHour || a.startMinute - b.startMinute;
|
||||
return a.startDateTime.getHours() - b.startDateTime.getHours() || a.startDateTime.getMinutes() - b.startDateTime.getMinutes();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -87,9 +86,13 @@ export class NewItemComponent implements OnInit {
|
||||
let date = this.appointmentForm.get('date').value
|
||||
let correctDate = new Date(date.year, date.month, date.day, startTime.hours, startTime.minutes);
|
||||
|
||||
let startDateTime = new Date(date.year, date.month, date.day, startTime.hours, startTime.minutes)
|
||||
let endDateTime = new Date(date.year, date.month, date.day, endTime.hours, endTime.minutes)
|
||||
|
||||
const customer = this.customerControl.value;
|
||||
|
||||
const appointment = new AppointmentDto(title, description, startTime.hours, startTime.minutes, endTime.hours, endTime.minutes, correctDate, customer)
|
||||
// constructor(id: string, title: string, description: string, startDateTime: Date, endDateTime: Date, customer: Customer, company: CompanyDTO)
|
||||
const appointment = new AppointmentDto(title, description, startDateTime, endDateTime, customer)
|
||||
this.waiting = true
|
||||
this.appointmentService.addAppointment(appointment, this.userService.currentCompany.id).subscribe(() => {
|
||||
this.waiting = false
|
||||
|
||||
Reference in New Issue
Block a user