folkehelseinstituttet / Fhi.Frontend.Demo

MIT License
2 stars 1 forks source link

Missing null check in DecimalPipe #556

Closed proand closed 5 months ago

proand commented 5 months ago

Description

  1. It's possible to set properties FhiDiagramOptions.decimals or FhiDiagramOptions.unit.decimals to null, but the decimal implementation doesn't support it!
  2. There is also a problem concerning how decimals are set: they should only be truncated, not padded with zeros!

Repro steps

  1. Create test data containing null
  2. Test in Demo-app

Stacktrace

global-error-handler.ts:15 Error: NG02100: InvalidPipeArgument: '1.null-null is not a valid digit info' for pipe 'DecimalPipe'
    at invalidPipeArgumentError (common.mjs:4053:12)
    at DecimalPipe.transform (common.mjs:4856:19)
    at pureFunction2Internal (core.mjs:28135:65)
    at Module.ɵɵpipeBind2 (core.mjs:28356:9)
    at FhiAngularHighchartsComponent_ng_template_13_tr_5_ng_container_1_td_2_ng_container_1_Template (folkehelseinstituttet-angular-highcharts.mjs:429:103)
proand commented 5 months ago

@bittakv @VillereV Description is updated.