Use moment for parsing dates of taskfieldinfo and adapt annotation for spring json parsing
All checks were successful
Java CI with Maven / build (push) Successful in 45s

This commit is contained in:
Sebastian Böckelmann 2023-11-13 19:49:36 +01:00
parent 9ca128d80d
commit 4f4c556bb9
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package core.api.models.timemanager.tasks;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
@ -11,7 +12,11 @@ public class TaskFieldInfo {
@Length(max = 255)
private String taskName;
private int eta;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
private LocalDate startDate;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
private LocalDate deadline;
public TaskFieldInfo() {

View File

@ -7,6 +7,7 @@ import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {TaskService} from "../../../api";
import {TaskEditorData} from "./TaskEditorData";
import {MatSnackBar} from "@angular/material/snack-bar";
import * as moment from "moment/moment";
@Component({
@ -53,8 +54,8 @@ export class TaskEditorComponent implements OnInit {
this.taskService.tasksTaskgroupIDPut(this.editorData.taskgroupID, {
taskName: this.nameCtrl.value,
eta: this.etaCtrl.value,
startDate: this.startDate.value,
deadline: this.endDate.value
startDate: moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
deadline: moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ')
}).subscribe({
next: resp => {
this.dialog.close(resp);