@hyper.software/common-helpers 1.12.4 → 1.12.5
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,5 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Moment } from 'moment';
|
|
2
2
|
import { DateOrString } from '../../interfaces';
|
|
3
3
|
export declare const getDays: (startDate: DateOrString, endDate: DateOrString) => any[];
|
|
4
4
|
export declare const normalizeDate: (date: Date | Moment | string | null) => Moment | null;
|
|
5
|
-
export declare const normalizeDateTimezone: (date: Date | moment.Moment | string | null, timezone: string) => moment.Moment | null;
|
|
@@ -3,16 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.normalizeDate = exports.getDays = void 0;
|
|
7
7
|
var moment_1 = __importDefault(require("moment"));
|
|
8
|
-
var moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
8
|
var helpers_1 = require("../../helpers");
|
|
10
|
-
function getDate(date) {
|
|
11
|
-
if (Object.prototype.toString.call(date) === '[object Date]') {
|
|
12
|
-
return date;
|
|
13
|
-
}
|
|
14
|
-
return new Date(date);
|
|
15
|
-
}
|
|
16
9
|
var getDays = function (startDate, endDate) {
|
|
17
10
|
var days = [];
|
|
18
11
|
var dateStart = (0, moment_1.default)(startDate);
|
|
@@ -35,20 +28,4 @@ var normalizeDate = function (date) {
|
|
|
35
28
|
});
|
|
36
29
|
};
|
|
37
30
|
exports.normalizeDate = normalizeDate;
|
|
38
|
-
var normalizeDateTimezone = function (date, timezone) {
|
|
39
|
-
if (!date) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
if (!timezone) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
var dt = getDate(date);
|
|
46
|
-
var momentDate = (0, moment_timezone_1.default)(dt);
|
|
47
|
-
return momentDate.tz(timezone).set({
|
|
48
|
-
hour: 15,
|
|
49
|
-
minute: 0,
|
|
50
|
-
second: 0,
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
exports.normalizeDateTimezone = normalizeDateTimezone;
|
|
54
31
|
//# sourceMappingURL=dateService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateService.js","sourceRoot":"","sources":["../../../src/services/dateService/dateService.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"dateService.js","sourceRoot":"","sources":["../../../src/services/dateService/dateService.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAuC;AACvC,yCAA4C;AAGrC,IAAM,OAAO,GAAG,UAAC,SAAuB,EAAE,OAAqB;IACpE,IAAM,IAAI,GAAG,EAAE,CAAA;IACf,IAAM,SAAS,GAAG,IAAA,gBAAM,EAAC,SAAS,CAAC,CAAA;IACnC,IAAM,OAAO,GAAG,IAAA,gBAAM,EAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;IAEnD,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,sBAAY,CAAC,UAAU,CAAC,CAAC,CAAA;QACpD,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;IAC1B,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAXY,QAAA,OAAO,WAWnB;AAEM,IAAM,aAAa,GAAG,UAAC,IAAmC;IAC/D,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAC,GAAG,CAAC;QACtB,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;KACV,CAAC,CAAA;AACJ,CAAC,CAAA;AAVY,QAAA,aAAa,iBAUzB"}
|