From a2ffdd436fcf16bc28290e9155ad45d1d63d8880 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Mon, 8 Nov 2021 16:56:11 +0100 Subject: [PATCH] fix(timestamp): add missing .isOlderThanOtherTimeStamp() to TimeStamp class --- ts/smarttime.classes.timestamp.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ts/smarttime.classes.timestamp.ts b/ts/smarttime.classes.timestamp.ts index 6546e46..63cd6aa 100644 --- a/ts/smarttime.classes.timestamp.ts +++ b/ts/smarttime.classes.timestamp.ts @@ -53,6 +53,19 @@ export class TimeStamp { this.epochtime = Math.floor(this.milliSeconds / 1000); } + /** + * returns a boolean for wether the timestamp is older than another timestamp + * @param TimeStampArg + * @param tresholdTimeArg + */ + public isOlderThanOtherTimeStamp(TimeStampArg: TimeStamp, tresholdTimeArg: number = 0) { + if (this.milliSeconds < TimeStampArg.milliSeconds - tresholdTimeArg) { + return true; + } else { + return false; + } + } + /** * Is the current instance older than the argument * @param TimeStampArg @@ -66,7 +79,7 @@ export class TimeStamp { } /** - * returns a boolean for wether a timestamp is younger + * returns a boolean for wether the timestamp is younger than another timestamp * @param TimeStampArg * @param tresholdTimeArg */