I use ng-bootstrap Datepicker something like here: plnkr example
but now after choose date I get object
Model: {
"year": 2016,
"month": 10,
"day": 13
}
But I would like get date in this format 2016-10-17
You can use NgbDateParserFormatter
import {NgbDateParserFormatter} from '@ng-bootstrap/ng-bootstrap';
constructor(private parserFormatter: NgbDateParserFormatter) {}
...
let date = this.parserFormatter.format(this.model);
Plunker
You can extract the particular properties of the object and construct your date string like this:
let date = this.Model.year + '-' + this.Model.month + '-' + this.Model.day
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With