Compare commits

..

4 Commits

Author SHA1 Message Date
c3a772c155 3.0.43 2021-11-08 16:56:11 +01:00
a2ffdd436f fix(timestamp): add missing .isOlderThanOtherTimeStamp() to TimeStamp class 2021-11-08 16:56:11 +01:00
da9c71eedb 3.0.42 2021-11-08 16:52:14 +01:00
63405fc577 fix(readme): fix readme 2021-11-08 16:52:13 +01:00
4 changed files with 18 additions and 5 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@pushrocks/smarttime",
"version": "3.0.41",
"version": "3.0.43",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@pushrocks/smarttime",
"version": "3.0.41",
"version": "3.0.43",
"license": "MIT",
"dependencies": {
"@pushrocks/lik": "^5.0.0",

View File

@ -1,7 +1,7 @@
{
"name": "@pushrocks/smarttime",
"private": false,
"version": "3.0.41",
"version": "3.0.43",
"description": "handle time in smart ways",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",

View File

@ -36,7 +36,7 @@ This class provides scheduling of functions with a cron syntax
```typescript
import { CronManager } from '@pushrocks/smarrtime';
const cronManagerInstance = new CronManager();
cronManagerInstance.addConrjob('* * * * * *', async () => {
cronManagerInstance.addCronjob('* * * * * *', async () => {
console.log('hello'); // will log 'hello' to console once every second;
});
cronManagerInstance.start();

View File

@ -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
*/