Ng-zorro-antd: NZ_I18N inconsistency with angular locale

Created on 8 Jan 2019  ·  1Comment  ·  Source: NG-ZORRO/ng-zorro-antd

Version

7.0.0-rc.3

Environment

Development

Reproduction link

https://stackblitz.com/edit/angular-h9aj2m?file=src%2Fapp%2Fapp.module.ts

Steps to reproduce

  • Set the NZ_I18N to pt_PT
  • Register angular locale data to pt-PT
  • There should be an error: "Error: InvalidPipeArgument: 'Missing locale data for the locale "pt".' for pipe 'DatePipe'"

What is expected?

No error should be return.

What is actually happening?

Currently, (Angular 7.2.0-rc.0) changed the default 'pt' locale to pt-BR. However, the NZ_I18N version of pt-PT is still expecting the locale to be 'pt'.
From now on the Angular default PT stopped meaning pt-PT but is now mapping to the locale pt-BR, see link: https://angular.io/guide/i18n#setting-up-the-locale-of-your-app .
This causes an inconsistency between ng-zorro and angular default PT meaning, since each one point to different locales.

Other?

Bug i18n

Most helpful comment

Check this post: https://github.com/angular/angular/issues/20286#issuecomment-343649893
Maybe this could work.

import pt from '@angular/common/locales/pt';
...
registerLocaleData(pt);

>All comments

Check this post: https://github.com/angular/angular/issues/20286#issuecomment-343649893
Maybe this could work.

import pt from '@angular/common/locales/pt';
...
registerLocaleData(pt);
Was this page helpful?
0 / 5 - 0 ratings