I'm sending an array holding objects which hold a date-attribute from angular to spring rest API. In the rest API this attribute is a LocalDate. Java takes all the the date attributes as null objects. How can I make sure the values get passed correct?
I've found this similar topic:
I have tried converting the date into a string which did not help. My question is different since I want to send an array holding objects which have a date attribute. So I cannot just send 1 date using params. Here below I posted the angular models and the service:
export interface DaysOfMonth {
dayType: DayTypes;
workingHours: number;
date: Date;
}
export interface MonthObject {
year: number;
month: number;
daysOfMonth: DaysOfMonth[];
}
export interface TimeSheet {
id: number;
username: string;
status: Status;
year: number;
month: number;
monthObject: MonthObject;
}
service:
@Injectable({
providedIn: 'root'
})
export class TimesheetService {
constructor(private http: HttpClient, private datePipe: DatePipe) { }
updateDaytype(sheet: TimeSheet): Observable<TimeSheet>{
console.log("updateDaytype reached")
const url = environment.TIMESHEETSAPI_URL + "timesheets/updateSheetById";
return this.http.put<TimeSheet>(url, sheet);
}
}