Due to Angular update, I have problem with locales.
For now:
import localePl from '@angular/common/locales/pl';
registerLocaleData(localePl);
It's working but causes an error:
WARNING in app.module.ts depends on @angular/common/locales/pl. CommonJS or AMD dependencies can cause optimization bailouts.
Where does it work?
- I provide
LOCALE_IDwith valuepl-PL - And use
DatePipein HTML. (variable | date) -variableis equal tonew Date()
Tested ways:
1)
import localePl from '@angular/common/locales/global/pl'; registerLocaleData(localePl, 'pl-PL');
Error:
'Cannot read property '0' of undefined' for pipe
In code:
variable | date
Where variable is equal to new Date()
2)
If I completely remove registerLocaleData
Error:
Missing locale data for the locale "pl-PL".' for pipe 'DatePipe'