asv-hlps 1.3.11 → 1.3.13

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/user.js CHANGED
@@ -57,6 +57,9 @@ exports.isBillPeriod = isBillPeriod;
57
57
  return [...steNames].includes(user.ste.name.toLowerCase());
58
58
  }; */
59
59
  const isStaffSte = (steNames, userSteName) => {
60
+ if (!userSteName) {
61
+ return false;
62
+ }
60
63
  return [...steNames].includes(userSteName.toLowerCase());
61
64
  };
62
65
  exports.isStaffSte = isStaffSte;
@@ -98,6 +98,6 @@ export declare const returnBool: (tob?: boolean) => boolean;
98
98
  export declare const monthStringName: (date: string | Date, format?: "MMM" | "MMMM", options?: {
99
99
  en?: true;
100
100
  }) => string;
101
- export declare const dateFormatter: (date: Date | string, format?: "ymd" | "dmy" | "dmy-hm" | "dmyfr" | "mfr-short" | "mfr-long", separator?: "/" | "-") => string;
101
+ export declare const dateFormatter: (date: Date | string, format?: "y" | "ymd" | "dmy" | "dmy-hm" | "dmyfr" | "myfr" | "mfr-short" | "mfr-long", separator?: "/" | "-") => string;
102
102
  export declare const countryIsoToFlag: (code: string) => string;
103
103
  export declare const removeParamKeyName: (params: any, name?: string) => any;
package/lib/cjs/utils.js CHANGED
@@ -139,7 +139,7 @@ const removeDuplicateObjects = (array, property = "id") => {
139
139
  uniqueIds.push(element[property]);
140
140
 
141
141
  return true;
142
- }
142
+ }π
143
143
 
144
144
  return false;
145
145
  });
@@ -625,6 +625,8 @@ const monthStringName = (date, format = "MMM", options) => {
625
625
  exports.monthStringName = monthStringName;
626
626
  const dateFormatter = (date, format, separator = "-") => {
627
627
  switch (format) {
628
+ case "y":
629
+ return (0, dayjs_1.default)(date).format("YYYY");
628
630
  case "ymd":
629
631
  return (0, dayjs_1.default)(date).format(`YYYY${separator}MM${separator}DD`);
630
632
  case "dmy":
@@ -633,6 +635,8 @@ const dateFormatter = (date, format, separator = "-") => {
633
635
  return (0, dayjs_1.default)(date).format(`DD${separator}MM${separator}YYYY HH:mm`);
634
636
  case "dmyfr":
635
637
  return (0, dayjs_1.default)(date).locale("fr").format("dddd DD MMMM YYYY");
638
+ case "myfr":
639
+ return (0, dayjs_1.default)(date).locale("fr").format("MMMM YYYY");
636
640
  case "mfr-short":
637
641
  return (0, dayjs_1.default)(date).locale("fr").format("MMM");
638
642
  case "mfr-long":
package/lib/esm/user.js CHANGED
@@ -24,6 +24,9 @@ export const isBillPeriod = (user, period) => {
24
24
  return [...steNames].includes(user.ste.name.toLowerCase());
25
25
  }; */
26
26
  export const isStaffSte = (steNames, userSteName) => {
27
+ if (!userSteName) {
28
+ return false;
29
+ }
27
30
  return [...steNames].includes(userSteName.toLowerCase());
28
31
  };
29
32
  // export const getFullname = (user: User | UserNotarial) => {
@@ -98,6 +98,6 @@ export declare const returnBool: (tob?: boolean) => boolean;
98
98
  export declare const monthStringName: (date: string | Date, format?: "MMM" | "MMMM", options?: {
99
99
  en?: true;
100
100
  }) => string;
101
- export declare const dateFormatter: (date: Date | string, format?: "ymd" | "dmy" | "dmy-hm" | "dmyfr" | "mfr-short" | "mfr-long", separator?: "/" | "-") => string;
101
+ export declare const dateFormatter: (date: Date | string, format?: "y" | "ymd" | "dmy" | "dmy-hm" | "dmyfr" | "myfr" | "mfr-short" | "mfr-long", separator?: "/" | "-") => string;
102
102
  export declare const countryIsoToFlag: (code: string) => string;
103
103
  export declare const removeParamKeyName: (params: any, name?: string) => any;
package/lib/esm/utils.js CHANGED
@@ -115,7 +115,7 @@ export const removeDuplicateObjects = (array, property = "id") => {
115
115
  uniqueIds.push(element[property]);
116
116
 
117
117
  return true;
118
- }
118
+ }π
119
119
 
120
120
  return false;
121
121
  });
@@ -544,6 +544,8 @@ export const monthStringName = (date, format = "MMM", options) => {
544
544
  };
545
545
  export const dateFormatter = (date, format, separator = "-") => {
546
546
  switch (format) {
547
+ case "y":
548
+ return dayjs(date).format("YYYY");
547
549
  case "ymd":
548
550
  return dayjs(date).format(`YYYY${separator}MM${separator}DD`);
549
551
  case "dmy":
@@ -552,6 +554,8 @@ export const dateFormatter = (date, format, separator = "-") => {
552
554
  return dayjs(date).format(`DD${separator}MM${separator}YYYY HH:mm`);
553
555
  case "dmyfr":
554
556
  return dayjs(date).locale("fr").format("dddd DD MMMM YYYY");
557
+ case "myfr":
558
+ return dayjs(date).locale("fr").format("MMMM YYYY");
555
559
  case "mfr-short":
556
560
  return dayjs(date).locale("fr").format("MMM");
557
561
  case "mfr-long":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.3.11",
3
+ "version": "1.3.13",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",