asv-hlps 1.2.93 → 1.2.94
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/lib/cjs/utils.d.ts +1 -1
- package/lib/cjs/utils.js +20 -12
- package/lib/esm/utils.d.ts +1 -1
- package/lib/esm/utils.js +20 -12
- package/package.json +1 -1
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare const formatNgbDate: (date: any) => {
|
|
|
58
58
|
};
|
|
59
59
|
export declare const genRandomColour: () => string;
|
|
60
60
|
export declare const getColorAccordingToDate: (inputDate: Date, period1?: number, period2?: number, period3?: number, ifClass?: boolean) => "red" | "DarkOrange" | "turquoise" | "blue" | "green" | "#f46a6a" | "#f1b44c" | "#cce5ff" | "#34c38f" | "#339900";
|
|
61
|
-
export declare const getPeriodDateColor: (inputDate:
|
|
61
|
+
export declare const getPeriodDateColor: (inputDate: string, period?: number) => "danger" | "warning" | "purple" | "success" | "info";
|
|
62
62
|
export declare const arrayMultiChecked: (objet: any[], event: boolean, item: any) => any[];
|
|
63
63
|
export declare const inputChecked: (event: any, item: any, checks: any[], isChecked?: boolean) => any[];
|
|
64
64
|
export declare const unCheckedAll: (checks?: any[]) => void;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -336,26 +336,34 @@ const getColorAccordingToDate = (inputDate, period1 = 3, period2 = 6, period3 =
|
|
|
336
336
|
return "#339900";
|
|
337
337
|
};
|
|
338
338
|
exports.getColorAccordingToDate = getColorAccordingToDate;
|
|
339
|
-
const getPeriodDateColor = (inputDate,
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
339
|
+
const getPeriodDateColor = (inputDate, period = 30) => {
|
|
340
|
+
const month0 = 0;
|
|
341
|
+
const month3 = period * 3;
|
|
342
|
+
const month6 = period * 6;
|
|
343
|
+
const month9 = period * 9;
|
|
344
|
+
const month12 = period * 12;
|
|
345
|
+
const today = (0, dayjs_1.default)(new Date());
|
|
346
|
+
const expDate = new Date(inputDate);
|
|
347
|
+
const diff = (0, dayjs_1.default)(expDate).diff(today, "day");
|
|
348
|
+
if (diff <= month0) {
|
|
349
|
+
// return "dark";
|
|
347
350
|
return "danger";
|
|
348
351
|
}
|
|
349
|
-
|
|
352
|
+
if (diff <= month3) {
|
|
353
|
+
return "danger";
|
|
354
|
+
}
|
|
355
|
+
if (diff <= month6) {
|
|
350
356
|
return "warning";
|
|
351
357
|
}
|
|
352
|
-
|
|
358
|
+
if (diff <= month9) {
|
|
353
359
|
return "purple";
|
|
354
360
|
}
|
|
355
|
-
|
|
361
|
+
if (diff <= month12) {
|
|
356
362
|
return "success";
|
|
357
363
|
}
|
|
358
|
-
|
|
364
|
+
if (diff > month12) {
|
|
365
|
+
return "info";
|
|
366
|
+
}
|
|
359
367
|
};
|
|
360
368
|
exports.getPeriodDateColor = getPeriodDateColor;
|
|
361
369
|
const arrayMultiChecked = (objet, event, item) => {
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare const formatNgbDate: (date: any) => {
|
|
|
58
58
|
};
|
|
59
59
|
export declare const genRandomColour: () => string;
|
|
60
60
|
export declare const getColorAccordingToDate: (inputDate: Date, period1?: number, period2?: number, period3?: number, ifClass?: boolean) => "red" | "DarkOrange" | "turquoise" | "blue" | "green" | "#f46a6a" | "#f1b44c" | "#cce5ff" | "#34c38f" | "#339900";
|
|
61
|
-
export declare const getPeriodDateColor: (inputDate:
|
|
61
|
+
export declare const getPeriodDateColor: (inputDate: string, period?: number) => "danger" | "warning" | "purple" | "success" | "info";
|
|
62
62
|
export declare const arrayMultiChecked: (objet: any[], event: boolean, item: any) => any[];
|
|
63
63
|
export declare const inputChecked: (event: any, item: any, checks: any[], isChecked?: boolean) => any[];
|
|
64
64
|
export declare const unCheckedAll: (checks?: any[]) => void;
|
package/lib/esm/utils.js
CHANGED
|
@@ -284,26 +284,34 @@ export const getColorAccordingToDate = (inputDate, period1 = 3, period2 = 6, per
|
|
|
284
284
|
}
|
|
285
285
|
return "#339900";
|
|
286
286
|
};
|
|
287
|
-
export const getPeriodDateColor = (inputDate,
|
|
288
|
-
const
|
|
289
|
-
const
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
287
|
+
export const getPeriodDateColor = (inputDate, period = 30) => {
|
|
288
|
+
const month0 = 0;
|
|
289
|
+
const month3 = period * 3;
|
|
290
|
+
const month6 = period * 6;
|
|
291
|
+
const month9 = period * 9;
|
|
292
|
+
const month12 = period * 12;
|
|
293
|
+
const today = dayjs(new Date());
|
|
294
|
+
const expDate = new Date(inputDate);
|
|
295
|
+
const diff = dayjs(expDate).diff(today, "day");
|
|
296
|
+
if (diff <= month0) {
|
|
297
|
+
// return "dark";
|
|
295
298
|
return "danger";
|
|
296
299
|
}
|
|
297
|
-
|
|
300
|
+
if (diff <= month3) {
|
|
301
|
+
return "danger";
|
|
302
|
+
}
|
|
303
|
+
if (diff <= month6) {
|
|
298
304
|
return "warning";
|
|
299
305
|
}
|
|
300
|
-
|
|
306
|
+
if (diff <= month9) {
|
|
301
307
|
return "purple";
|
|
302
308
|
}
|
|
303
|
-
|
|
309
|
+
if (diff <= month12) {
|
|
304
310
|
return "success";
|
|
305
311
|
}
|
|
306
|
-
|
|
312
|
+
if (diff > month12) {
|
|
313
|
+
return "info";
|
|
314
|
+
}
|
|
307
315
|
};
|
|
308
316
|
export const arrayMultiChecked = (objet, event, item) => {
|
|
309
317
|
const findItem = objet.find((x) => x.id === item.id);
|