Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive whitespace character in CurrencyPipe #34641

Closed
troelslenda opened this issue Jan 5, 2020 · 0 comments
Closed

Excessive whitespace character in CurrencyPipe #34641

troelslenda opened this issue Jan 5, 2020 · 0 comments

Comments

@troelslenda
Copy link
Contributor

@troelslenda troelslenda commented Jan 5, 2020

馃悶 bug report

Affected Package

@angular/common/i18n

Is this a regression?

No

Description

When using locales that dictates a whitespace character between the currency and symbol and supressing the symbol/code the pipe outouts the formatted currency with either prepending or trailing whitespace.

馃敩 Minimal Reproduction

In a clean ng project - setup locales for ie. Danish.

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule, LOCALE_ID } from '@angular/core';

import { AppComponent } from './app.component';

 import {registerLocaleData } from '@angular/common';
 import localeDa from '@angular/common/locales/da';


 registerLocaleData(localeDa, 'da-DK');

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [{
    provide: LOCALE_ID,
    useValue: 'da-DK'
  }],
  bootstrap: [AppComponent]
})
export class AppModule { }

app.component.html

<p>-{{ 1000 | currency: 'DKK': 'symbol'}}-</p>
<p>-{{ 1000 | currency: 'DKK': ''}}-</p>

馃敟 Exception or Error

Note that the second line renders with a trailing whitespace character

-1.000,00 kr.-
-1.000,00 -

馃實 Your Environment

Angular Version:




Angular CLI: 8.3.21
Node: 13.3.0
OS: linux x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.21
@angular-devkit/build-angular     0.803.21
@angular-devkit/build-optimizer   0.803.21
@angular-devkit/build-webpack     0.803.21
@angular-devkit/core              8.3.21
@angular-devkit/schematics        8.3.21
@angular/cli                      8.3.21
@ngtools/webpack                  8.3.21
@schematics/angular               8.3.21
@schematics/update                0.803.21
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

Anything else relevant?

Kudos to my colleague @Graahf at @DGI-IT for initially finding the bug

troelslenda added a commit to troelslenda/angular that referenced this issue Jan 5, 2020
Trimming any surrounding whitespace characters in
formatNumberToLocaleString if currency symbol is
supressed.

Closes angular#34641
troelslenda added a commit to troelslenda/angular that referenced this issue Jan 6, 2020
鈥urrounding whitespace characters informatNumberToLocaleString if currency symbol issupressed.Closes angular#34641
troelslenda added a commit to troelslenda/angular that referenced this issue Jan 6, 2020
Trimming any surrounding whitespace characters informatNumberToLocaleString
if currency symbol issupressed.

Closes angular#34641
@ngbot ngbot bot modified the milestone: needsTriage Jan 6, 2020
alxhub added a commit that referenced this issue Jan 7, 2020
Trimming any surrounding whitespace characters informatNumberToLocaleString
if currency symbol issupressed.

Closes #34641

PR Close #34642
@alxhub alxhub closed this in 1b6ad15 Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can鈥檛 perform that action at this time.