Я занимаюсь разработкой клиентского портала.Laravel-5.8 - это бэкэнд, а Angular-7 - это фронтенд.Я использую POST REQUEST.
client-quote-landing.component.ts
import { Component, OnInit, Inject, LOCALE_ID, TemplateRef } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { ClientQuoteService } from '../../../../shared/services/client-quote.service';
import { first } from 'rxjs/operators';
import { ToastrService } from 'ngx-toastr';
import { formatDate } from '@angular/common';
import { Validators, FormBuilder, FormGroup, FormControl } from '@angular/forms';
@Component({
selector: 'app-client-quote-landing',
templateUrl: './client-quote-landing.component.html',
styleUrls: ['./client-quote-landing.component.scss']
})
export class ClientQuoteLandingComponent implements OnInit {
quoteModel: any = {};
formattedAddress = '';
truck_types = [];
constructor(
private clientQuoteService: ClientQuoteService, private toastr: ToastrService,
private router: Router,
@Inject(LOCALE_ID) private locale: string,
private route: ActivatedRoute
) {
}
ngOnInit() {
window.dispatchEvent(new Event('load'));
window.dispatchEvent(new Event('resize'));
}
client-quote-landing.component.html
<form name="quote" #quoteform="ngForm" (ngSubmit)="onCreateQuote(quoteform);" method="post" novalidate>
<div class="row">
<div class="col-xs-12">
<div class="col-xs-6">
<label for="loading_date">Loading Date<span style="color:red;"> *</span></label>
<div class="input-group date">
<mat-form-field>
<input matInput [matDatepicker] = "picker" placeholder = "Choose a date" name="loading_date" [(ngModel)]="quoteModel.loading_date" #loading_date="ngModel" [ngClass]="{'is-invalid' : loading_date.invalid && ((loading_date.dirty || loading_date.touched) || quoteform.submitted)}" required>
<mat-datepicker-toggle matSuffix [for] = "picker"></mat-datepicker-toggle>
</mat-form-field>
<div class="form-feedback" *ngIf="loading_date.invalid && ((loading_date.dirty || loading_date.touched) || quoteform.submitted)">
<div style="color:red;" *ngIf="loading_date.errors?.required"class="alert alert-danger">Loading Date is required.</div>
</div>
</div>
</div>
</div>
</div>
<button style="margin:5px" type="submit" class="btn btn-success" > Get A Quote</button>
</form>
КогдаЯ нажал на кнопку отправки, ничего не происходило, затем я проверил сеть и получил эту ошибку:
сообщение: «SQLSTATE [22007]: неверный формат даты и времени: 1292 Неверное значение даты: '2019-09-26T23: 00: 00.000Z 'для столбца clientportal
. client_quotes
. loading_date
в строке 1 (SQL: вставить в client_quotes
(first_name
, last_name
, email
, phone
, business_name
, address
, comment
, truck_type
, truck_required
, quote_origin
, quote_destination
, commodity
, loading_date
, updated_at
, created_at
) (Майкл, Идову, noblemfd@yahoo.com, 33334444444444, jolamic, ddsds, dd, жилой, 2, ddds, ssa, ee, 2019-09-26T23: 00: 00.000Z, 2019-09-19 00:53:55, 2019-09-19 00:53:55)) "
В базе данных MySQL loading_date тип данных - дата.
Как устранить эту ошибку?