* and do not require entry in our 'providers' array.
*/
import {NgModule} from '@angular/core';
-import {CommonModule, DatePipe, CurrencyPipe} from '@angular/common';
+import {CommonModule, DatePipe, DecimalPipe} from '@angular/common';
import {FormatService, FormatValuePipe} from './format.service';
@NgModule({
],
providers: [
DatePipe,
- CurrencyPipe
+ DecimalPipe
]
})
import {Injectable, Pipe, PipeTransform} from '@angular/core';
-import {DatePipe, CurrencyPipe, getLocaleDateFormat, getLocaleTimeFormat, getLocaleDateTimeFormat, FormatWidth} from '@angular/common';
+import {DatePipe, DecimalPipe, getLocaleDateFormat, getLocaleTimeFormat, getLocaleDateTimeFormat, FormatWidth} from '@angular/common';
import {IdlService, IdlObject} from '@eg/core/idl.service';
import {OrgService} from '@eg/core/org.service';
import {LocaleService} from '@eg/core/locale.service';
constructor(
private datePipe: DatePipe,
- private currencyPipe: CurrencyPipe,
+ private decimalPipe: DecimalPipe,
private idl: IdlService,
private org: OrgService,
private locale: LocaleService
return this.datePipe.transform(date.toISOString(true), fmt, date.format('ZZ'));
case 'money':
- return this.currencyPipe.transform(value);
+ // TODO: this used to use CurrencyPipe, but that injected
+ // an assumption that the default currency is always going to be
+ // USD. Since CurrencyPipe doesn't have an apparent way to specify
+ // that that currency symbol shouldn't be displayed at all, it
+ // was switched to DecimalPipe
+ return this.decimalPipe.transform(value, '1.2-2');
case 'bool':
// Slightly better than a bare 't' or 'f'.
-import {DatePipe, CurrencyPipe, registerLocaleData} from '@angular/common';
+import {DatePipe, DecimalPipe, registerLocaleData} from '@angular/common';
import {IdlService} from './idl.service';
import {EventService} from './event.service';
import {DbStoreService} from './db-store.service';
describe('FormatService', () => {
- let currencyPipe: CurrencyPipe;
+ let decimalPipe: DecimalPipe;
let datePipe: DatePipe;
let idlService: IdlService;
let netService: NetService;
let service: FormatService;
beforeEach(() => {
- currencyPipe = new CurrencyPipe('en');
+ decimalPipe = new DecimalPipe('en');
datePipe = new DatePipe('en');
idlService = new IdlService();
evtService = new EventService();
value: '12.1',
datatype: 'money'
});
- expect(str).toBe('$12.10');
+ expect(str).toBe('12.10');
});
it('should transform M/d/yy, h:mm a Angular format string to a valid MomentJS one', () => {