Reputation: 1
In Angular 6 I click on a date time picker and set a label to the selected value.
At the moment it is showing as { "_value": "2018-09-14T09:30:00.000Z" }
How can I show only the value, 2018-09-14T09:30:00.000Z?
Here is the html
<dl-date-time-picker minuteStep="15" (change)="myDateChanged($event)"></dl-date-time-picker>
<label class="text-secondary">{{ myDate | json }}</label>
and the called code
myDateChanged(val: string) {
this.myDate = JSON.stringify(val);
}
Upvotes: 0
Views: 1682
Reputation: 376
Change the function to
myDateChanged(val: any) {
this.myDate = val._value;
}
And remove the json pipe from the html and you should be good
Upvotes: 1
Reputation: 41397
access the myDate._value
property
<label class="text-secondary">{{ myDate._value }}</label>
Upvotes: 0