Angular2 material and date - how to get selected date
Dudes from the angular2 stuff apparently didn't want to show how to get the selected date ... selectedChanged returns the latest date.
<md-input-container>
<input mdInput [mdDatepicker]="picker" placeholder="Choose a date" [(ngModel)]="wtf">
<button mdSuffix [mdDatepickerToggle]="picker"></button>
</md-input-container>
<md-datepicker #picker [startAt]="startDate" (selectedChanged)="duder()"></md-datepicker>
duder(){
console.log('duder',this.startDate,this.wtf)
console.log('duder--r',moment(this.wtf).format('DD-MM-YYYY'))
}
I mean wow. I am making changes .. and what I get is the latest date .. not the current date I chose.
If I change the date ... how do I get the current date from my duder () function?
+3
source to share
1 answer