Skip to content
Prev Previous commit
Next Next commit
refactor: TTA-196 number of fixed digits as constant with name
  • Loading branch information
mmaquina committed Oct 21, 2022
commit d260b32c5fb7ee47549d6721aedef216d0441e9a
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';

let FIXED_POINT_DIGITS 1;
@Pipe({
name: 'substractDateDisplayAsFloat'
})
Expand All @@ -14,7 +16,7 @@ export class SubstractDatePipeDisplayAsFloat implements PipeTransform {
const startDate = moment(substractDate);
const endDate = moment(fromDate);
const duration = this.getTimeDifference(startDate, endDate);
return duration.asHours().toFixed(1).toString();
return duration.asHours().toFixed(FIXED_POINT_DIGITS).toString();
}

getTimeDifference(substractDate: moment.Moment, fromDate: moment.Moment): moment.Duration {
Expand Down