@molochko-dev/data 1.4.110 → 1.4.112
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.
- package/dist/helpers/date.d.ts +1 -1
- package/dist/helpers/date.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/src/helpers/date.ts +5 -1
- package/src/index.ts +9 -8
package/dist/helpers/date.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const getMonthFromDate: (dateString: string) => number;
|
|
2
|
-
export declare function datestrToDate(dateStr: string): Date;
|
|
2
|
+
export declare function datestrToDate(dateStr: string): Date | null;
|
package/dist/helpers/date.js
CHANGED
|
@@ -12,6 +12,10 @@ const getMonthFromDate = (dateString) => {
|
|
|
12
12
|
exports.getMonthFromDate = getMonthFromDate;
|
|
13
13
|
/* преобразование строки 251201 в дату*/
|
|
14
14
|
function datestrToDate(dateStr) {
|
|
15
|
+
const re = /^((25|26|27|28|29|30|31|32|33)(01|02|03|04|05|06|07|08|09|10|11|12)\d\d)$/;
|
|
16
|
+
if (!re.test(dateStr)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
15
19
|
const year = '20' + dateStr.substring(0, 2); // 2022
|
|
16
20
|
const month = dateStr.substring(2, 4); // 12
|
|
17
21
|
const day = dateStr.substring(4, 6); // 02
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import * as _animalEnums from './animals';
|
|
|
9
9
|
import * as _eqEnums from './easy-query';
|
|
10
10
|
import * as _orgConstants from './org';
|
|
11
11
|
import * as _milkEnums from './milk';
|
|
12
|
+
import * as _dateHelpers from './helpers/date';
|
|
12
13
|
export declare const enums: {
|
|
13
14
|
BREED: typeDefinitions.EnumItem[];
|
|
14
15
|
BREED_AS_OBJECT: typeDefinitions.EnumArrayAsObject;
|
|
@@ -57,4 +58,5 @@ export declare const eventEnums: typeof _animalForEventFilters.enums;
|
|
|
57
58
|
export declare const eqEnums: typeof _eqEnums.enums;
|
|
58
59
|
export declare const orgConstants: typeof _orgConstants.constants;
|
|
59
60
|
export declare const milkEnums: typeof _milkEnums.enums;
|
|
61
|
+
export declare const dateHelpers: typeof _dateHelpers;
|
|
60
62
|
export * as event from './event';
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.event = exports.milkEnums = exports.orgConstants = exports.eqEnums = exports.eventEnums = exports.animalEnums = exports.animalForEventFilters = exports.importEnums = exports.animalTagEnums = exports.customListEnums = exports.types = exports.rolePermissions = exports.enums = void 0;
|
|
26
|
+
exports.event = exports.dateHelpers = exports.milkEnums = exports.orgConstants = exports.eqEnums = exports.eventEnums = exports.animalEnums = exports.animalForEventFilters = exports.importEnums = exports.animalTagEnums = exports.customListEnums = exports.types = exports.rolePermissions = exports.enums = void 0;
|
|
27
27
|
const dataEnums = __importStar(require("./enums"));
|
|
28
28
|
const breed_1 = require("./breed");
|
|
29
29
|
const typeDefinitions = __importStar(require("./types"));
|
|
@@ -37,6 +37,7 @@ const _eventEnums = __importStar(require("./event"));
|
|
|
37
37
|
const _eqEnums = __importStar(require("./easy-query"));
|
|
38
38
|
const _orgConstants = __importStar(require("./org"));
|
|
39
39
|
const _milkEnums = __importStar(require("./milk"));
|
|
40
|
+
const _dateHelpers = __importStar(require("./helpers/date"));
|
|
40
41
|
exports.enums = Object.assign(Object.assign({}, dataEnums), { BREED: breed_1.BREED, BREED_AS_OBJECT: breed_1.BREED_AS_OBJECT });
|
|
41
42
|
exports.rolePermissions = _rolePermissions;
|
|
42
43
|
exports.types = typeDefinitions;
|
|
@@ -49,6 +50,7 @@ exports.eventEnums = _eventEnums.enums;
|
|
|
49
50
|
exports.eqEnums = _eqEnums.enums;
|
|
50
51
|
exports.orgConstants = _orgConstants.constants;
|
|
51
52
|
exports.milkEnums = _milkEnums.enums;
|
|
53
|
+
exports.dateHelpers = _dateHelpers;
|
|
52
54
|
// export { events } from './event';
|
|
53
55
|
// export type { events as EventType } from './event';
|
|
54
56
|
exports.event = __importStar(require("./event"));
|
package/package.json
CHANGED
package/src/helpers/date.ts
CHANGED
|
@@ -6,7 +6,11 @@ export const getMonthFromDate = (dateString: string) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
/* преобразование строки 251201 в дату*/
|
|
9
|
-
export function datestrToDate(dateStr: string): Date {
|
|
9
|
+
export function datestrToDate(dateStr: string): Date | null {
|
|
10
|
+
const re = /^((25|26|27|28|29|30|31|32|33)(01|02|03|04|05|06|07|08|09|10|11|12)\d\d)$/;
|
|
11
|
+
if (!re.test(dateStr)) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
10
14
|
const year = '20' + dateStr.substring(0, 2); // 2022
|
|
11
15
|
const month = dateStr.substring(2, 4); // 12
|
|
12
16
|
const day = dateStr.substring(4, 6); // 02
|
package/src/index.ts
CHANGED
|
@@ -8,10 +8,10 @@ import * as _importEnums from './import-data';
|
|
|
8
8
|
import * as _animalTagEnums from './animal-tag';
|
|
9
9
|
import * as _animalEnums from './animals';
|
|
10
10
|
import * as _eventEnums from './event';
|
|
11
|
-
import * as _eqEnums from './easy-query'
|
|
12
|
-
import * as _orgConstants from './org'
|
|
13
|
-
import * as _milkEnums from './milk'
|
|
14
|
-
|
|
11
|
+
import * as _eqEnums from './easy-query';
|
|
12
|
+
import * as _orgConstants from './org';
|
|
13
|
+
import * as _milkEnums from './milk';
|
|
14
|
+
import * as _dateHelpers from './helpers/date';
|
|
15
15
|
export const enums = { ...dataEnums, BREED, BREED_AS_OBJECT };
|
|
16
16
|
export const rolePermissions = _rolePermissions;
|
|
17
17
|
export const types = typeDefinitions;
|
|
@@ -21,10 +21,11 @@ export const importEnums = _importEnums.enums;
|
|
|
21
21
|
export const animalForEventFilters = _animalForEventFilters;
|
|
22
22
|
export const animalEnums = _animalEnums.enums;
|
|
23
23
|
export const eventEnums = _eventEnums.enums;
|
|
24
|
-
export const eqEnums = _eqEnums.enums
|
|
25
|
-
export const orgConstants = _orgConstants.constants
|
|
26
|
-
export const milkEnums = _milkEnums.enums
|
|
24
|
+
export const eqEnums = _eqEnums.enums;
|
|
25
|
+
export const orgConstants = _orgConstants.constants;
|
|
26
|
+
export const milkEnums = _milkEnums.enums;
|
|
27
|
+
export const dateHelpers = _dateHelpers;
|
|
27
28
|
|
|
28
29
|
// export { events } from './event';
|
|
29
30
|
// export type { events as EventType } from './event';
|
|
30
|
-
export * as event from './event';
|
|
31
|
+
export * as event from './event';
|