Refactoring betreft date object
All checks were successful
Docker Image CI / build-and-push (push) Successful in 2m0s
Docker Image CI / deploy (push) Successful in 45s
Docker Image CI / notify-failure (push) Has been skipped

This commit is contained in:
2025-05-25 18:05:19 +02:00
parent 7a977a6ba5
commit 2c1b7eed35
15 changed files with 96 additions and 72 deletions

View File

@@ -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