Error DatePipe Angular 6

0

I just updated my application from Angle 5 to Angle 6.

When I save a record in the Firebase database using mat-datepicker checking the database I noticed that it is saving the date correctly with timestamp .

>

Birth date: (July 12, 2018 00:00:00 UTC-3) .

When listing the records I can not use the PipeDate of the Angular because an error is occurring, since it is returning from the database (Timestamp (seconds = 1531 .. ) in the data_name column in mat- table ;

Before doing this update for Angle 6, I was just saving the Date () object that mat-datepicker created and mat-table I could do {{date_girl | date}} normally.

In my app.module.ts: I'm setting the LOCALE_ID ;

import { registerLocaleData } from '@angular/common';
import localePt from '@angular/common/locales/pt';
registerLocaleData(localePt);

providers: [
    { provide: LOCALE_ID, useValue: 'pt-BR' },
]

I have tried to remove LOCALE_ID leaving the default, but it still is not working correctly, when returning the Date () object that mat-date-picker creates in the database , the date is not displayed in input or mat-table ;

I do not know if this is a change of Firebase or Angular, I do not know what to do because I can not show the birth_date in mat-table and neither < strong> form .

    
asked by anonymous 18.05.2018 / 18:05

1 answer

0

You have already tried to convert the received date into a new Date (). I've done this several times and it worked.

Another thing too, I care about the core to use Locale: import {LOCALE_ID} from "@ angular / core";

Try some of these options there. For me it worked!

    
08.06.2018 / 19:52