<input
[value]="question.timestampToMoment(row.controls[column.name].value)"
[formControlName]="column.name"
[required]="column.required"
matInput
[matDatepicker]="picker"
(dateChange)="question.onDateChange($event)"
placeholder="Choose a date"
/>
I would like the FormControl
that's attached to this datepicker
have the timestamp as the value, so that the timestamp can be sent back to the backend. Then in setting the value of this datepicker
when the value comes back from the backend, I would need to convert it back to a moment
object from the timestamp.
I imagine timestampToMoment
would look like: return moment(value * 1000)
I can't figure out how to implement onDateChange
or any other way to make this work though. The datepicker
uses moment.js
.