does the filter with new date() accept format other than yyyy-mm-dd?

I have a response from mydatepicker in the following format


I have a filter that uses the new date(), but it seems that it doesn’t accept it accepting the date in the value dd-mm-yyyy and I would need to display it like this, not like this yyyy-mm-dd

  filterPeriodos() {
const d = new Date( + 'T23:59');
if ( === 1) {
        return this.periodos.filter( transpId =>   transpId.ativo === (1) && transpId.transporte_id === (this.metodoId) && transpId.week[d.getDay()] === 1 ) ;
 return this.periodos;

would anyone have any suggestions?

>Solution :

To get the end of a day, first convert the parse-able text into a date, then manipulate that date.

let object =;          // for our sanity
let jsDate = new Date(object.singleDate.jsDate);

Keep the formatted string around for display, but do any date computations on the real date object.

Leave a Reply