https://puu.sh/yThgV/bd55df9829.png
html
<label for="date">{{ "date" | translate }}</label>
<input type="date" class="form-control checking-field" id="date">
I want to get that format ('dd/mm/yyyy'). Any Suggestion?
extends my comment
In your app.module
import { NgbDatepickerConfig, NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap';
import { NgbDateFRParserFormatter } from "./ngb-date-fr-parser-formatter"
@Component({
providers: [{provide: NgbDateParserFormatter, useClass: NgbDateFRParserFormatter}]
})
export class AppComponent {}
In your NgbDateFRParserFormater
//your NgbDateFRParserFormater extends from NgbDateParserFormatter
//Is a Injectable that have two functions
@Injectable()
export class NgbDateFRParserFormatter extends NgbDateParserFormatter {
parse(value: string): NgbDateStruct { //parse receive your string dd/mm/yyy
//return a NgbDateStruct
//calculate year,month and day from "value"
return {year:year,month:month,day:day}
}
format(date: NgbDateStruct): string { //receive a NgbDateStruct
//return a string
return ''+date.day+'/'+date.month+'/'+date.year;
}
}
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