@react-pakistan/util-functions 1.24.82 → 1.24.83

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.
@@ -0,0 +1,13 @@
1
+ export interface IMonthNameMap {
2
+ /**
3
+ *
4
+ */
5
+ [key: string]: number;
6
+ }
7
+ export declare const monthNameMap: IMonthNameMap;
8
+ /**
9
+ * Get the UTC month number (0-11) from a month name
10
+ * @param monthName - The name of the month (case-insensitive)
11
+ * @returns The UTC month number (0-11), or -1 if the month name is invalid
12
+ */
13
+ export declare const getMonthNumber: (monthName: string) => number;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMonthNumber = exports.monthNameMap = void 0;
4
+ exports.monthNameMap = {
5
+ january: 0,
6
+ february: 1,
7
+ march: 2,
8
+ april: 3,
9
+ may: 4,
10
+ june: 5,
11
+ july: 6,
12
+ august: 7,
13
+ september: 8,
14
+ october: 9,
15
+ november: 10,
16
+ december: 11,
17
+ };
18
+ /**
19
+ * Get the UTC month number (0-11) from a month name
20
+ * @param monthName - The name of the month (case-insensitive)
21
+ * @returns The UTC month number (0-11), or -1 if the month name is invalid
22
+ */
23
+ var getMonthNumber = function (monthName) {
24
+ var normalizedName = monthName.toLowerCase().trim();
25
+ return exports.monthNameMap[normalizedName] !== undefined
26
+ ? exports.monthNameMap[normalizedName]
27
+ : -1;
28
+ };
29
+ exports.getMonthNumber = getMonthNumber;
@@ -33,6 +33,7 @@ export * from './get-day-name';
33
33
  export * from './get-full-name';
34
34
  export * from './get-href';
35
35
  export * from './get-month-name';
36
+ export * from './get-month-number';
36
37
  export * from './get-number-of-days-in-month';
37
38
  export * from './get-pathname';
38
39
  export * from './get-week-day';
package/general/index.js CHANGED
@@ -49,6 +49,7 @@ __exportStar(require("./get-day-name"), exports);
49
49
  __exportStar(require("./get-full-name"), exports);
50
50
  __exportStar(require("./get-href"), exports);
51
51
  __exportStar(require("./get-month-name"), exports);
52
+ __exportStar(require("./get-month-number"), exports);
52
53
  __exportStar(require("./get-number-of-days-in-month"), exports);
53
54
  __exportStar(require("./get-pathname"), exports);
54
55
  __exportStar(require("./get-week-day"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.24.82",
3
+ "version": "1.24.83",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {