Open SGStino opened 5 years ago
anybody has a fix for this?
@sibelius you have to import moment-duration-format
before changing the locale.
I import it only once in a service:
import { Injectable } from '@angular/core';
import * as moment from 'moment';
import 'moment-duration-format';
@Injectable({
providedIn: 'root',
})
export class LanguageService {
private lang: string;
constructor( ) {}
getLang(): string {
return this.lang;
}
setLang(lang: string) {
this.lang = lang;
moment.locale(this.lang);
}
}
when importing moment-duration-format in a lazy loaded module component (angular pages)
import 'moment-duration-format';
the locale set (moment.locale('nl')
) in the constructor of the AppComponent seems to be reset.If I import moment-duration-format in the AppComponent and not in the Page's Component, the locale doesn't get reset.