asv-hlps 1.3.25 → 1.3.27

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.
@@ -88,7 +88,7 @@ export declare const returnBool: (tob?: boolean) => boolean;
88
88
  export declare const monthStringName: (date: string | Date, format?: "MMM" | "MMMM", options?: {
89
89
  en?: true;
90
90
  }) => string;
91
- export declare const dateFormatter: (date: Date | string, format?: "y" | "ymd" | "dmy" | "ago" | "md" | "dmy-hm" | "dmyfr" | "myfr" | "mfr-short" | "mfr-long", separator?: "/" | "" | "-") => string;
91
+ export declare const dateFormatter: (date: Date | string, format?: "y" | "ym" | "ymd" | "dmy" | "ago" | "md" | "dmy-hm" | "dmyfr" | "myfr" | "mfr-short" | "mfr-long", separator?: "/" | "" | "-") => string;
92
92
  export declare const countryIsoToFlag: (code: string) => string;
93
93
  export declare const removeParamKeyName: (params: any, name?: string) => any;
94
94
  export declare const toggleProp: (tob: any, propToToggle: string) => any;
package/lib/cjs/utils.js CHANGED
@@ -26,7 +26,7 @@ const name = () => { };
26
26
  /* export const formatFromAndToDate = (fromDate: Date, toDate: Date) => {
27
27
  const getFromDate = !fromDate ? new Date() : fromDate;
28
28
  const getToDate = !toDate ? fromDate : toDate;
29
- return formatDateYmdHypenFr(new Date(getFromDate)) + " au " + formatDateYmdHypenFr(new Date(getToDate));
29
+ return dateFormatter(new Date(getFromDate)) + " au " + dateFormatter(new Date(getToDate));
30
30
  }; */
31
31
  /* export const formatDateYmd = (date: Date | any, separator: string = "") => {
32
32
  return formatDateYm(date, separator) + separator + ("0" + date.getUTCDate()).slice(-2);
@@ -240,7 +240,8 @@ const findFirstSequenceMissing = (arr) => {
240
240
  };
241
241
  exports.findFirstSequenceMissing = findFirstSequenceMissing;
242
242
  const deepClone = (obj) => {
243
- return JSON.parse(JSON.stringify(obj));
243
+ // return JSON.parse(JSON.stringify(obj));
244
+ return lodash_1.default.cloneDeep(obj);
244
245
  };
245
246
  exports.deepClone = deepClone;
246
247
  const removeString = (text, word) => {
@@ -619,6 +620,8 @@ const dateFormatter = (date, format = "dmy", separator = "/") => {
619
620
  switch (format) {
620
621
  case "y":
621
622
  return (0, dayjs_1.default)(date).format("YYYY");
623
+ case "ym":
624
+ return (0, dayjs_1.default)(date).format(`YYYY${separator}MM`);
622
625
  case "ymd":
623
626
  return (0, dayjs_1.default)(date).format(`YYYY${separator}MM${separator}DD`);
624
627
  case "md":
@@ -88,7 +88,7 @@ export declare const returnBool: (tob?: boolean) => boolean;
88
88
  export declare const monthStringName: (date: string | Date, format?: "MMM" | "MMMM", options?: {
89
89
  en?: true;
90
90
  }) => string;
91
- export declare const dateFormatter: (date: Date | string, format?: "y" | "ymd" | "dmy" | "ago" | "md" | "dmy-hm" | "dmyfr" | "myfr" | "mfr-short" | "mfr-long", separator?: "/" | "" | "-") => string;
91
+ export declare const dateFormatter: (date: Date | string, format?: "y" | "ym" | "ymd" | "dmy" | "ago" | "md" | "dmy-hm" | "dmyfr" | "myfr" | "mfr-short" | "mfr-long", separator?: "/" | "" | "-") => string;
92
92
  export declare const countryIsoToFlag: (code: string) => string;
93
93
  export declare const removeParamKeyName: (params: any, name?: string) => any;
94
94
  export declare const toggleProp: (tob: any, propToToggle: string) => any;
package/lib/esm/utils.js CHANGED
@@ -19,7 +19,7 @@ const name = () => { };
19
19
  /* export const formatFromAndToDate = (fromDate: Date, toDate: Date) => {
20
20
  const getFromDate = !fromDate ? new Date() : fromDate;
21
21
  const getToDate = !toDate ? fromDate : toDate;
22
- return formatDateYmdHypenFr(new Date(getFromDate)) + " au " + formatDateYmdHypenFr(new Date(getToDate));
22
+ return dateFormatter(new Date(getFromDate)) + " au " + dateFormatter(new Date(getToDate));
23
23
  }; */
24
24
  /* export const formatDateYmd = (date: Date | any, separator: string = "") => {
25
25
  return formatDateYm(date, separator) + separator + ("0" + date.getUTCDate()).slice(-2);
@@ -210,7 +210,8 @@ export const findFirstSequenceMissing = (arr) => {
210
210
  return findSequencesMissing(arr)[0];
211
211
  };
212
212
  export const deepClone = (obj) => {
213
- return JSON.parse(JSON.stringify(obj));
213
+ // return JSON.parse(JSON.stringify(obj));
214
+ return lodash.cloneDeep(obj);
214
215
  };
215
216
  export const removeString = (text, word) => {
216
217
  return text.toLowerCase().replace(word.toLowerCase(), "") || text;
@@ -549,6 +550,8 @@ export const dateFormatter = (date, format = "dmy", separator = "/") => {
549
550
  switch (format) {
550
551
  case "y":
551
552
  return dayjs(date).format("YYYY");
553
+ case "ym":
554
+ return dayjs(date).format(`YYYY${separator}MM`);
552
555
  case "ymd":
553
556
  return dayjs(date).format(`YYYY${separator}MM${separator}DD`);
554
557
  case "md":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.3.25",
3
+ "version": "1.3.27",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -18,16 +18,16 @@
18
18
  "devDependencies": {
19
19
  "@types/bcryptjs": "^2.4.4",
20
20
  "@types/lodash": "^4.14.198",
21
- "@types/pdfmake": "^0.2.2",
21
+ "@types/pdfmake": "^0.2.3",
22
22
  "@types/randomatic": "^3.1.3",
23
- "@types/react": "^18.2.21",
23
+ "@types/react": "^18.2.22",
24
24
  "typescript": "^5.2.2"
25
25
  },
26
26
  "dependencies": {
27
27
  "axios": "^1.5.0",
28
28
  "bcryptjs": "^2.4.3",
29
29
  "classnames": "^2.3.2",
30
- "dayjs": "^1.11.9",
30
+ "dayjs": "^1.11.10",
31
31
  "jwt-decode": "^3.1.2",
32
32
  "lodash": "^4.17.21",
33
33
  "pdfmake": "^0.2.7",