2
Hello,
I am using ngx-bootstrap datepicker for the first time and am encountering some difficulties.
One of them is that when selecting the desired date, my input is in the exact format I need, as follows: '12/20/2018', but when I play on the console the input value, is presented as follows: 'Thu Dec 20 2018 23:26:21 GMT-0200 (Brasilia Daylight Saving Time)'.
How do I leave the input value with the Brazilian format: '20/12/2018'. I searched the documentation and could not find.
Evidence of how it’s working(wrong).
Evidence of the properties:
How you played on the console the input value?
– Sam
As it is reactiveForms, I put it this way: console.log(this.formulario.Controls.data.value);
– Guilherme Nunes
Dude, put
console.log(this.formulario.controls.data)
and check the properties if you have anything with20/12/2018
.– Sam
I looked too and I didn’t find, if you want, I can send the print with the evidence
– Guilherme Nunes
I edited the question and inserted the photo
– Guilherme Nunes
Know another datepicker that works well?
– Guilherme Nunes
Dude, I don’t know much. Try it like this:
var dia = this.formulario.controls.data.value;
console.log(dia.getDate()+"/"+Number(dia.getMonth()+1)+"/"+dia.getFullYear());

– Sam
Boooa, so it was... Create an answer then I give ok
– Guilherme Nunes
William, I am finding it difficult for the input to be in the correct format, if you can take a look at this question it would be of great help. https://answall.com/questions/401796/angular-8-ngx-bootstrap-datepicker
– Alessandro