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');
}
}));
}
+ /** Sorting the list based on date @public */
+ public compareFunction = (dir: number, a: string, b: string): number => {
+ const first: number = new Date(a).getTime();
+ const second: number = new Date(b).getTime();
+ if (first < second) {
+ return -1 * dir;
+ }
+ if (first > second) {
+ return dir;
+ }
+ return 0;
+ };
+
/** Method to validate file extension and size @private */
private vaildataFileInfo(fileInfo: File, fileType: string): boolean {
const extension: string = fileInfo.name.substring(fileInfo.name.lastIndexOf('.') + 1);