Fix JSON Parse Error Invalid Date #90

Merged
sebastian merged 1 commits from fix-issue-87 into master 2023-12-21 11:31:13 +01:00

View File

@ -53,13 +53,14 @@ export class TaskEditorComponent implements OnInit {
createTask() { createTask() {
let endDate_formatted: string|undefined = undefined; let endDate_formatted: string|undefined = undefined;
let startDate_formatted: string|undefined = undefined; let startDate_formatted: string|undefined = undefined;
if(this.endDate.value !== "") { if(this.endDate.value != undefined && this.endDate.value !== "") {
endDate_formatted = moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ'); endDate_formatted = moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
} }
if(this.startDate.value !== "") { if(this.endDate.value != undefined && this.startDate.value !== "") {
startDate_formatted = moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ'); startDate_formatted = moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
} }
this.taskService.tasksTaskgroupIDPut(this.editorData.taskgroupID, { this.taskService.tasksTaskgroupIDPut(this.editorData.taskgroupID, {
taskName: this.nameCtrl.value, taskName: this.nameCtrl.value,
eta: this.etaCtrl.value, eta: this.etaCtrl.value,
@ -87,13 +88,14 @@ export class TaskEditorComponent implements OnInit {
editTask() { editTask() {
let endDate_formatted: string|undefined = undefined; let endDate_formatted: string|undefined = undefined;
let startDate_formatted: string|undefined = undefined; let startDate_formatted: string|undefined = undefined;
if(this.endDate.value !== "") { if(this.endDate.value != undefined && this.endDate.value !== "") {
endDate_formatted = moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ'); endDate_formatted = moment(this.endDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
} }
if(this.startDate.value !== "") { if(this.startDate.value != undefined && this.startDate.value !== "") {
startDate_formatted = moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ'); startDate_formatted = moment(this.startDate.value).format('YYYY-MM-DDTHH:mm:ss.SSSZ');
} }
this.taskService.tasksTaskIDPost(this.editorData.task!.taskID, { this.taskService.tasksTaskIDPost(this.editorData.task!.taskID, {
taskName: this.nameCtrl.value, taskName: this.nameCtrl.value,
eta: this.etaCtrl.value, eta: this.etaCtrl.value,