law-common 10.0.1-beta.2 → 10.0.1-beta.4
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
1
|
import { EntityEnum, EnumEntityType, IEntityFilterData } from "../entities";
|
|
2
|
-
import { DateCodeModel } from "./models/date-code.model.util";
|
|
3
2
|
export declare function groupByFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T[]>;
|
|
4
3
|
export declare function groupByOneToOneFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T>;
|
|
5
4
|
export declare function convertMapToObject<K, T>(map: Map<K, T>): {
|
|
@@ -168,7 +167,3 @@ export declare function numberToWordsIndian(numStr: string): string;
|
|
|
168
167
|
*/
|
|
169
168
|
export declare function minutesToHoursMinutes(totalMinutes: number): string;
|
|
170
169
|
export declare function createKeyLabelMap<Entity>(): Record<keyof Entity, string>;
|
|
171
|
-
export declare function getFinancialYearRange(dateCodeModel: DateCodeModel): {
|
|
172
|
-
startDate: string;
|
|
173
|
-
endDate: string;
|
|
174
|
-
};
|
|
@@ -30,9 +30,7 @@ exports.setResponseValue = setResponseValue;
|
|
|
30
30
|
exports.numberToWordsIndian = numberToWordsIndian;
|
|
31
31
|
exports.minutesToHoursMinutes = minutesToHoursMinutes;
|
|
32
32
|
exports.createKeyLabelMap = createKeyLabelMap;
|
|
33
|
-
exports.getFinancialYearRange = getFinancialYearRange;
|
|
34
33
|
const util_constants_1 = require("../constants/util.constants");
|
|
35
|
-
const date_code_model_util_1 = require("./models/date-code.model.util");
|
|
36
34
|
function groupByFunction(list, keyGetter) {
|
|
37
35
|
const map = new Map();
|
|
38
36
|
list.forEach((item) => {
|
|
@@ -369,16 +367,3 @@ function createKeyLabelMap() {
|
|
|
369
367
|
},
|
|
370
368
|
});
|
|
371
369
|
}
|
|
372
|
-
function getFinancialYearRange(dateCodeModel) {
|
|
373
|
-
const date = dateCodeModel.getDate();
|
|
374
|
-
const year = date.getFullYear();
|
|
375
|
-
const month = date.getMonth() + 1; // 1-based
|
|
376
|
-
const fyStartYear = month < 4 ? year - 1 : year;
|
|
377
|
-
const fyEndYear = month < 4 ? year : year + 1;
|
|
378
|
-
const start = new Date(fyStartYear, 3, 1); // April 1
|
|
379
|
-
const end = new Date(fyEndYear, 2, 31); // March 31
|
|
380
|
-
return {
|
|
381
|
-
startDate: date_code_model_util_1.DateCodeModel.fromDate(start),
|
|
382
|
-
endDate: date_code_model_util_1.DateCodeModel.fromDate(end),
|
|
383
|
-
};
|
|
384
|
-
}
|
|
@@ -10,4 +10,8 @@ export declare class DateCodeModel {
|
|
|
10
10
|
getFormattedDateWithMonthName(): string;
|
|
11
11
|
static formatDateCode(dateCode: string): string;
|
|
12
12
|
isWithinOffset(offsetInDays: number): boolean;
|
|
13
|
+
static getFinancialYearRange(dateCodeModel: DateCodeModel): {
|
|
14
|
+
startDate: DateCodeModel;
|
|
15
|
+
endDate: DateCodeModel;
|
|
16
|
+
};
|
|
13
17
|
}
|
|
@@ -61,5 +61,18 @@ class DateCodeModel {
|
|
|
61
61
|
const onTimeDateModel = todaysDateModel.getByOffset(offsetInDays);
|
|
62
62
|
return this.getDate() >= onTimeDateModel.getDate();
|
|
63
63
|
}
|
|
64
|
+
static getFinancialYearRange(dateCodeModel) {
|
|
65
|
+
const date = dateCodeModel.getDate();
|
|
66
|
+
const year = date.getFullYear();
|
|
67
|
+
const month = date.getMonth() + 1; // 1-based
|
|
68
|
+
const fyStartYear = month < 4 ? year - 1 : year;
|
|
69
|
+
const fyEndYear = month < 4 ? year : year + 1;
|
|
70
|
+
const start = new Date(fyStartYear, 3, 1); // April 1
|
|
71
|
+
const end = new Date(fyEndYear, 2, 31); // March 31
|
|
72
|
+
return {
|
|
73
|
+
startDate: new DateCodeModel(DateCodeModel.fromDate(start)),
|
|
74
|
+
endDate: new DateCodeModel(DateCodeModel.fromDate(end)),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
64
77
|
}
|
|
65
78
|
exports.DateCodeModel = DateCodeModel;
|