ngx-bootstrap + angular 6 + datepicker

2

Hello,

I'm using ngx-bootstrap's datepicker for the first time and I'm encountering some difficulties.

One of them is that by selecting the desired date, my input is in the exact format I need, as follows: '20 / 12/2018 ', however when I play in the console the input value is presented as follows : 'Thu Dec 20 2018 23:26:21 GMT-0200 (Brasília Summer Time)'.

How do I leave the input value with the Brazilian format: '20 / 12/2018 '. I searched the documentation for it and could not find it.

Evidence of how it works (wrong).

Evidenceofproperties:

    
asked by anonymous 21.12.2018 / 02:30

1 answer

2

Construct the date in Brazilian format from the date it is returning from the Thu Dec 20 2018 23:26:21 GMT-0200 (Horário de Verão de Brasília) element:

var dia = this.formulario.controls.data.value;
dia = dia.getDate()+"/"+Number(dia.getMonth()+1)+"/"+dia.getFullYear();

The result will be: 20/12/2018

    
21.12.2018 / 03:33