sim-node-lib 0.0.35 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare class
|
|
1
|
+
export declare class DateHelper {
|
|
2
2
|
static normalizeDate(mixedDate: Date | string | undefined | Date): Date;
|
|
3
3
|
static validateDateBetweenTwoDatesWithDate(fromDate: Date, toDate: Date, givenDate: Date): boolean;
|
|
4
4
|
static validateDateBetweenTwoDatesWithString(fromDate: Date, toDate: Date, givenDate: Date): boolean;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DateHelper = void 0;
|
|
4
4
|
const moment = require("moment");
|
|
5
|
-
class
|
|
5
|
+
class DateHelper {
|
|
6
6
|
static normalizeDate(mixedDate) {
|
|
7
7
|
return typeof mixedDate === 'string' ? new Date() : mixedDate;
|
|
8
8
|
}
|
|
9
9
|
static validateDateBetweenTwoDatesWithDate(fromDate, toDate, givenDate) {
|
|
10
|
-
return
|
|
10
|
+
return givenDate <= this.normalizeDate(toDate) && givenDate >= this.normalizeDate(fromDate);
|
|
11
11
|
}
|
|
12
12
|
static validateDateBetweenTwoDatesWithString(fromDate, toDate, givenDate) {
|
|
13
|
-
return
|
|
13
|
+
return this.validateDateBetweenTwoDatesWithDate(fromDate, toDate, this.normalizeDate(givenDate));
|
|
14
14
|
}
|
|
15
15
|
static validateCurrentDateBetweenTwoDates(fromDate, toDate) {
|
|
16
|
-
return
|
|
16
|
+
return this.validateDateBetweenTwoDatesWithDate(fromDate, toDate, new Date());
|
|
17
17
|
}
|
|
18
18
|
static dateToStringFormatBR(date) {
|
|
19
19
|
return this.dateToStringFormat(date, 'DD/MM/yyyy');
|
|
@@ -26,4 +26,4 @@ class DateUtils {
|
|
|
26
26
|
return Math.trunc((Math.abs(startData.getTime() - endData.getTime()) / 36e5) * 60);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
exports.
|
|
29
|
+
exports.DateHelper = DateHelper;
|