Incorrect Angular Brasilian time after daylight saving time

Asked

Viewed 211 times

1

I have an application in Angular and need to display the correct time in the system, there was no change in daylight saving time in Brazil and I am informing the time in the system one hour late.

app.modulets.:

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

providers: [
    { provide: MAT_DATE_LOCALE, useValue: 'pt-BR' },
    { provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] },
    { provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
    { provide: LOCALE_ID, useValue: 'pt-BR' },
]

Component.:

import * as moment from 'moment';
moment.locale('pt-br');

interval(1000).subscribe(() => this.horaAtual = moment().toDate());

After daylight saving time I can no longer get the correct time as it is an hour late.

How can I get the right time of Brasilia?

  • 1

    But it’s been almost a week and the server you get the time hasn’t tidied up yet??

  • The only option is to take the computer time, but I have a scheduling system and this also affected the schedule, since I use the local time.

  • In the system is an hour late and do not know how to fix it.

  • I don’t know much about Moment, but if you do Moment(). hour() +1 it doesn’t solve?

  • yes if you do Moment(). add('hour', 1) resolves the time display, but my schedule will continue with local time late.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.