8 Answer(s)
-
0
Try
.toDate()instead:[(ngModel)]="pssaleh.docDate.toDate()"From https://momentjs.com/guides/#/lib-concepts/internal-properties:
As such, the values of
_dand any other properties prefixed with_should not be used for any purpose.To print out the value of a Moment, use
.format(),.toString()or.toISOString().To retrieve a native Date object from Moment, use
.toDate(). This function returns a properly shifted date for interaction with third party APIs.Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @aaron it is not working. I'm sharing code with you. please help me in this regard. actually on initialize I also want to show current date seleected.
HTML :
<input class="form-control m-input form-control-sm" [(ngModel)]="pssaleh.docDate.toDate()" type="datetime" bsDatepicker id="PSSALEH_DocDate" name="PSSALEH_DocDate">TS :
ngOnInit() { this.pssaleh = new CreateOrEditPSSALEHDto(); this.pssaleh.docDate = moment(); }Class :
export class CreateOrEditPSSALEHDto { docDate!: moment.Moment | undefined; }kindly help me in this regard. As We have alot of date fields in our application
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
What's the error now?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
-
0
That seems unrelated. Can you show the full line?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
-
0
I was mistaken about
[(ngModel)].ASP<span></span>.NET Zero v7.2.0+ implements
datePickerMomentModifierdirective. Try this:- [(ngModel)]="pssaleh.docDate.toDate()" + datePickerMomentModifier + [(date)]="pssaleh.docDate"Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
This issue is closed because it has not had recent activity for a long time.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)



