Override locale adapted date in Material Datepicker and Material Input

Discussão em 'Angular' iniciado por MarCordero385, Março 22, 2025.

  1. I'm using the Material Library for an Angular 18.2.10 application that uses in several parts of it the Datepicker component along with Input component, just as show in the documentation. In order to show months in the language required, I've set the component's providers like the following:

    providers: [
    provideNativeDateAdapter(),
    { provide: MAT_DATE_LOCALE, useValue: 'es-MX' }
    ]


    My issue is that the dates related to these fields, stored in UTC format in DB, are being converted to the browsers locale which causes an offset of minus one day.

    [​IMG]

    [​IMG]

    I've already searched for solutions and some recommend Moment adapter as a solution, which didn't work for me. Is there any way to turn off this localization and just show the date as it comes from the DB?

    Continue reading...

Compartilhe esta Página