Fix Bug 2293: Password Expiry and Account Expiry Time Issue for today & tomorrow scenarios
- For today & tomorrow used Math.round
- For more than one day concept used Math.floor
Change-Id: Ifcc08ae030a7643b3ed0306867513065b06c2007
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
diff --git a/src/services/SharedService.ts b/src/services/SharedService.ts
index 8abe1d2..ba805e6 100644
--- a/src/services/SharedService.ts
+++ b/src/services/SharedService.ts
@@ -191,8 +191,12 @@
if (!isNullOrUndefined(date)) {
const today: Date = new Date();
const accountDate: Date = new Date(date);
- return Math.floor((accountDate.getTime() -
- today.getTime()) / this.epochTime1000 / this.epochTime60 / this.epochTime60 / this.epochTime24);
+ const toasterDate: number = (accountDate.getTime() -
+ today.getTime()) / this.epochTime1000 / this.epochTime60 / this.epochTime60 / this.epochTime24;
+ if (toasterDate >= 0 || toasterDate < 1) {
+ return Math.round(toasterDate);
+ }
+ return Math.floor(toasterDate);
}
return this.translateService.instant('N/A');
}