@fctc/widget-logic 5.3.1 → 5.3.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.
@@ -0,0 +1 @@
1
+ export * from '@fctc/interface-logic/store';
@@ -0,0 +1 @@
1
+ export * from '@fctc/interface-logic/store';
package/dist/store.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+
17
+ // src/store.ts
18
+ var store_exports = {};
19
+ module.exports = __toCommonJS(store_exports);
20
+ __reExport(store_exports, require("@fctc/interface-logic/store"), module.exports);
21
+ // Annotate the CommonJS export names for ESM import in node:
22
+ 0 && (module.exports = {
23
+ ...require("@fctc/interface-logic/store")
24
+ });
package/dist/store.mjs ADDED
@@ -0,0 +1,2 @@
1
+ // src/store.ts
2
+ export * from "@fctc/interface-logic/store";
package/dist/utils.d.mts CHANGED
@@ -6,8 +6,14 @@ declare const languages: {
6
6
  }[];
7
7
 
8
8
  declare const countSum: (data: any[], field: string) => number;
9
- declare const isObjectEmpty: (obj: object) => boolean;
10
9
  declare function mergeButtons(fields: any): any;
10
+ declare const getDateRange: (currentDate: any, unit: string) => string[][];
11
+ declare const convertFieldsToArray: (fields: any[] | undefined | null) => any[];
12
+ declare function combineContexts(contexts: ({
13
+ [key: string]: any;
14
+ } | undefined)[]): {
15
+ [key: string]: any;
16
+ } | undefined;
11
17
  declare const STORAGES: {
12
18
  readonly TOKEN: "accessToken";
13
19
  readonly USER_INFO: "USER_INFO";
@@ -16,8 +22,5 @@ type UseStateHook<T> = [[boolean, T | null], (value: T | null) => void];
16
22
  type StorageKey = keyof typeof STORAGES;
17
23
  declare function setStorageItemAsync(key: StorageKey, value: string | null): Promise<void>;
18
24
  declare function useStorageState(key: StorageKey): UseStateHook<string>;
19
- declare const guessTypeFromUrl: (url: string) => any;
20
25
 
21
- declare const validateAndParseDate: (input: string, isDateTime?: boolean) => string | null;
22
-
23
- export { STORAGES, countSum, guessTypeFromUrl, isObjectEmpty, languages, mergeButtons, setStorageItemAsync, useStorageState, validateAndParseDate };
26
+ export { STORAGES, combineContexts, convertFieldsToArray, countSum, getDateRange, languages, mergeButtons, setStorageItemAsync, useStorageState };
package/dist/utils.d.ts CHANGED
@@ -6,8 +6,14 @@ declare const languages: {
6
6
  }[];
7
7
 
8
8
  declare const countSum: (data: any[], field: string) => number;
9
- declare const isObjectEmpty: (obj: object) => boolean;
10
9
  declare function mergeButtons(fields: any): any;
10
+ declare const getDateRange: (currentDate: any, unit: string) => string[][];
11
+ declare const convertFieldsToArray: (fields: any[] | undefined | null) => any[];
12
+ declare function combineContexts(contexts: ({
13
+ [key: string]: any;
14
+ } | undefined)[]): {
15
+ [key: string]: any;
16
+ } | undefined;
11
17
  declare const STORAGES: {
12
18
  readonly TOKEN: "accessToken";
13
19
  readonly USER_INFO: "USER_INFO";
@@ -16,8 +22,5 @@ type UseStateHook<T> = [[boolean, T | null], (value: T | null) => void];
16
22
  type StorageKey = keyof typeof STORAGES;
17
23
  declare function setStorageItemAsync(key: StorageKey, value: string | null): Promise<void>;
18
24
  declare function useStorageState(key: StorageKey): UseStateHook<string>;
19
- declare const guessTypeFromUrl: (url: string) => any;
20
25
 
21
- declare const validateAndParseDate: (input: string, isDateTime?: boolean) => string | null;
22
-
23
- export { STORAGES, countSum, guessTypeFromUrl, isObjectEmpty, languages, mergeButtons, setStorageItemAsync, useStorageState, validateAndParseDate };
26
+ export { STORAGES, combineContexts, convertFieldsToArray, countSum, getDateRange, languages, mergeButtons, setStorageItemAsync, useStorageState };
package/dist/utils.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -18,28 +16,20 @@ var __copyProps = (to, from, except, desc) => {
18
16
  return to;
19
17
  };
20
18
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
20
 
31
21
  // src/utils.ts
32
22
  var utils_exports = {};
33
23
  __export(utils_exports, {
34
24
  STORAGES: () => STORAGES,
25
+ combineContexts: () => combineContexts,
26
+ convertFieldsToArray: () => convertFieldsToArray,
35
27
  countSum: () => countSum,
36
- guessTypeFromUrl: () => guessTypeFromUrl,
37
- isObjectEmpty: () => isObjectEmpty,
28
+ getDateRange: () => getDateRange,
38
29
  languages: () => languages,
39
30
  mergeButtons: () => mergeButtons,
40
31
  setStorageItemAsync: () => setStorageItemAsync,
41
- useStorageState: () => useStorageState,
42
- validateAndParseDate: () => validateAndParseDate
32
+ useStorageState: () => useStorageState
43
33
  });
44
34
  module.exports = __toCommonJS(utils_exports);
45
35
 
@@ -58,9 +48,6 @@ var countSum = (data, field) => {
58
48
  0
59
49
  );
60
50
  };
61
- var isObjectEmpty = (obj) => {
62
- return Object.keys(obj).length === 0;
63
- };
64
51
  function mergeButtons(fields) {
65
52
  const buttons = fields?.filter((f) => f.type_co === "button");
66
53
  const others = fields?.filter((f) => f.type_co !== "button");
@@ -72,6 +59,103 @@ function mergeButtons(fields) {
72
59
  }
73
60
  return others;
74
61
  }
62
+ var getDateRange = (currentDate, unit) => {
63
+ const date = new Date(currentDate);
64
+ let dateStart, dateEnd;
65
+ function formatDate(d) {
66
+ return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0") + " " + String(d.getHours()).padStart(2, "0") + ":" + String(d.getMinutes()).padStart(2, "0") + ":" + String(d.getSeconds()).padStart(2, "0");
67
+ }
68
+ switch (unit) {
69
+ case "month":
70
+ dateStart = new Date(
71
+ date.getFullYear(),
72
+ date.getMonth() + 1,
73
+ date.getDate(),
74
+ 23,
75
+ 59,
76
+ 59
77
+ );
78
+ dateStart.setHours(dateStart.getHours() - 7);
79
+ dateEnd = new Date(date.getFullYear(), date.getMonth(), 0, 0, 0, 0);
80
+ dateEnd.setHours(dateEnd.getHours() - 7);
81
+ break;
82
+ case "day":
83
+ dateStart = new Date(
84
+ date.getFullYear(),
85
+ date.getMonth(),
86
+ date.getDate(),
87
+ 23,
88
+ 59,
89
+ 59
90
+ );
91
+ dateStart.setHours(dateStart.getHours() - 7);
92
+ dateEnd = new Date(
93
+ date.getFullYear(),
94
+ date.getMonth(),
95
+ date.getDate(),
96
+ 0,
97
+ 0,
98
+ 0
99
+ );
100
+ dateEnd.setHours(dateEnd.getHours() - 7);
101
+ break;
102
+ case "week":
103
+ const dayOfWeek = date.getDay();
104
+ const daysToMonday = dayOfWeek === 0 ? -6 : 1 - dayOfWeek;
105
+ const daysToSunday = dayOfWeek === 0 ? 0 : 7 - dayOfWeek;
106
+ dateStart = new Date(
107
+ date.getFullYear(),
108
+ date.getMonth(),
109
+ date.getDate() + daysToSunday,
110
+ 23,
111
+ 59,
112
+ 59
113
+ );
114
+ dateStart.setHours(dateStart.getHours() - 7);
115
+ dateEnd = new Date(
116
+ date.getFullYear(),
117
+ date.getMonth(),
118
+ date.getDate() + daysToMonday,
119
+ 0,
120
+ 0,
121
+ 0
122
+ );
123
+ dateEnd.setHours(dateEnd.getHours() - 7);
124
+ break;
125
+ case "year":
126
+ dateStart = new Date(date.getFullYear(), 11, 31, 23, 59, 59);
127
+ dateStart.setHours(dateStart.getHours() - 7);
128
+ dateEnd = new Date(date.getFullYear() - 1, 11, 31, 0, 0, 0);
129
+ dateEnd.setHours(dateEnd.getHours() - 7);
130
+ break;
131
+ default:
132
+ throw new Error(
133
+ "\u0110\u01A1n v\u1ECB kh\xF4ng h\u1EE3p l\u1EC7. Ch\u1EC9 ch\u1EA5p nh\u1EADn: week, day, month, year"
134
+ );
135
+ }
136
+ return [
137
+ ["date_start", "<=", formatDate(dateStart)],
138
+ ["date_end", ">=", formatDate(dateEnd)]
139
+ ];
140
+ };
141
+ var convertFieldsToArray = (fields) => {
142
+ const defaultFields = ["display_name", "date_start", "date_end"];
143
+ if (!fields || !Array.isArray(fields)) {
144
+ return defaultFields;
145
+ }
146
+ const inputFields = fields.filter((field) => field && field.type_co === "field").map((field) => field.name);
147
+ return [...defaultFields, ...inputFields];
148
+ };
149
+ function combineContexts(contexts) {
150
+ if (contexts.some((context) => !context)) {
151
+ return void 0;
152
+ } else {
153
+ const res = contexts.reduce((acc, context) => {
154
+ return { ...acc, ...context };
155
+ }, {});
156
+ return res;
157
+ }
158
+ }
75
159
  var STORAGES = {
76
160
  TOKEN: "accessToken",
77
161
  USER_INFO: "USER_INFO"
@@ -112,325 +196,19 @@ function useStorageState(key) {
112
196
  );
113
197
  return [state, setValue];
114
198
  }
115
- var guessTypeFromUrl = (url) => {
116
- const ext = url.split(".").pop()?.toLowerCase();
117
- if (!ext) return null;
118
- const map = {
119
- jpg: "image/jpeg",
120
- jpeg: "image/jpeg",
121
- png: "image/png",
122
- webp: "image/webp",
123
- gif: "image/gif",
124
- svg: "image/svg+xml",
125
- bmp: "image/bmp",
126
- tiff: "image/tiff",
127
- pdf: "application/pdf",
128
- zip: "application/zip",
129
- rar: "application/x-rar-compressed",
130
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
131
- xls: "application/vnd.ms-excel",
132
- mp4: "video/mp4",
133
- mov: "video/quicktime"
134
- };
135
- return map[ext] || null;
136
- };
137
-
138
- // src/utils/format-date.ts
139
- var import_moment = __toESM(require("moment"));
140
- var validateAndParseDate = (input, isDateTime = false) => {
141
- if (!input || typeof input !== "string") return null;
142
- const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
143
- const dateFormat = "YYYY-MM-DD";
144
- const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
145
- const currentDay = (0, import_moment.default)().format("DD");
146
- const currentMonth = (0, import_moment.default)().format("MM");
147
- const currentYear = (0, import_moment.default)().format("YYYY");
148
- const defaultTime = "00:00:00";
149
- const maxYear = parseInt(currentYear) + 10;
150
- const isValidDate = (day, month, year) => {
151
- const date = (0, import_moment.default)(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
152
- return date.isValid();
153
- };
154
- const isValidTime = (hour, minute = "00", second = "00") => {
155
- const h = parseInt(hour, 10);
156
- const m = parseInt(minute, 10);
157
- const s = parseInt(second, 10);
158
- return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
159
- };
160
- const formatOutput = (day, month, year, time = defaultTime) => {
161
- let result = (0, import_moment.default)(
162
- `${day}-${month}-${year} ${time}`,
163
- "DD-MM-YYYY HH:mm:ss"
164
- );
165
- if (!result.isValid()) return null;
166
- if (isDateTime) {
167
- result = result.subtract(7, "hours");
168
- return result.format(dateTimeFormat);
169
- }
170
- return result.format(dateFormat);
171
- };
172
- if (isDateTime && input.match(
173
- /^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
174
- )) {
175
- const [datePart, timePart] = input.split(/\s+/);
176
- const dateParts = datePart.split(/[\/-]/);
177
- const timeParts = timePart.split(":");
178
- const day = dateParts[0].padStart(2, "0");
179
- const month = dateParts[1].padStart(2, "0");
180
- const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
181
- const hour = timeParts[0].padStart(2, "0");
182
- const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
183
- const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
184
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
185
- let result = (0, import_moment.default)(
186
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
187
- "DD-MM-YYYY HH:mm:ss"
188
- );
189
- if (!result.isValid()) return null;
190
- result = result.subtract(7, "hours");
191
- return result.format(dateTimeFormat);
192
- }
193
- return null;
194
- }
195
- if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
196
- const [year, month, day] = cleanInput.split("-");
197
- if (isValidDate(day, month, year)) {
198
- return formatOutput(day, month, year);
199
- }
200
- return null;
201
- }
202
- if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
203
- const [day, month, year] = cleanInput.split("/");
204
- const paddedDay = day.padStart(2, "0");
205
- const paddedMonth = month.padStart(2, "0");
206
- const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
207
- if (isValidDate(paddedDay, paddedMonth, fullYear)) {
208
- return formatOutput(paddedDay, paddedMonth, fullYear);
209
- }
210
- return null;
211
- }
212
- if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
213
- const [day, month, year] = cleanInput.split("-");
214
- const paddedDay = day.padStart(2, "0");
215
- const paddedMonth = month.padStart(2, "0");
216
- const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
217
- if (isValidDate(paddedDay, paddedMonth, fullYear)) {
218
- return formatOutput(paddedDay, paddedMonth, fullYear);
219
- }
220
- return null;
221
- }
222
- if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
223
- const [day, month] = cleanInput.split(/[\/-]/);
224
- const paddedDay = day.padStart(2, "0");
225
- const paddedMonth = month.padStart(2, "0");
226
- if (isValidDate(paddedDay, paddedMonth, currentYear)) {
227
- return formatOutput(paddedDay, paddedMonth, currentYear);
228
- }
229
- return null;
230
- }
231
- if (cleanInput.match(/^\d{4}$/)) {
232
- const num = parseInt(cleanInput, 10);
233
- if (num >= 2e3 && num <= maxYear) {
234
- if (isValidDate(currentDay, currentMonth, num.toString())) {
235
- return formatOutput(currentDay, currentMonth, num.toString());
236
- }
237
- return null;
238
- }
239
- const day = cleanInput.slice(0, 2);
240
- const month = cleanInput.slice(2, 4);
241
- if (isValidDate(day, month, currentYear)) {
242
- return formatOutput(day, month, currentYear);
243
- }
244
- return null;
245
- }
246
- if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
247
- const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
248
- let result = (0, import_moment.default)().subtract(daysToSubtract, "days");
249
- if (isDateTime) {
250
- result = result.subtract(7, "hours");
251
- }
252
- if (result.isValid()) {
253
- return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
254
- }
255
- return null;
256
- }
257
- if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
258
- const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
259
- const day = parts[0].padStart(2, "0");
260
- const month = parts[1].padStart(2, "0");
261
- let year = parts[2];
262
- year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
263
- if (isValidDate(day, month, year)) {
264
- return formatOutput(day, month, year);
265
- }
266
- return null;
267
- }
268
- if (isDateTime) {
269
- if (cleanInput.length === 9) {
270
- const day = cleanInput.slice(0, 2);
271
- const month = cleanInput.slice(2, 4);
272
- const year = cleanInput.slice(4, 8);
273
- const hour = cleanInput.slice(8, 9).padStart(2, "0");
274
- if (isValidDate(day, month, year) && isValidTime(hour)) {
275
- let result = (0, import_moment.default)(
276
- `${day}-${month}-${year} ${hour}:00:00`,
277
- "DD-MM-YYYY HH:mm:ss"
278
- );
279
- if (!result.isValid()) return null;
280
- result = result.subtract(7, "hours");
281
- return result.format(dateTimeFormat);
282
- }
283
- return null;
284
- }
285
- if (cleanInput.length === 10) {
286
- const day = cleanInput.slice(0, 2);
287
- const month = cleanInput.slice(2, 4);
288
- const year = cleanInput.slice(4, 8);
289
- const hour = cleanInput.slice(8, 10);
290
- if (isValidDate(day, month, year) && isValidTime(hour)) {
291
- let result = (0, import_moment.default)(
292
- `${day}-${month}-${year} ${hour}:00:00`,
293
- "DD-MM-YYYY HH:mm:ss"
294
- );
295
- if (!result.isValid()) return null;
296
- result = result.subtract(7, "hours");
297
- return result.format(dateTimeFormat);
298
- }
299
- return null;
300
- }
301
- if (cleanInput.length === 11) {
302
- const day = cleanInput.slice(0, 2);
303
- const month = cleanInput.slice(2, 4);
304
- const year = cleanInput.slice(4, 8);
305
- const hour = cleanInput.slice(8, 10);
306
- const minute = cleanInput.slice(10, 11).padStart(2, "0");
307
- if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
308
- let result = (0, import_moment.default)(
309
- `${day}-${month}-${year} ${hour}:${minute}:00`,
310
- "DD-MM-YYYY HH:mm:ss"
311
- );
312
- if (!result.isValid()) return null;
313
- result = result.subtract(7, "hours");
314
- return result.format(dateTimeFormat);
315
- }
316
- return null;
317
- }
318
- if (cleanInput.length === 12) {
319
- const day = cleanInput.slice(0, 2);
320
- const month = cleanInput.slice(2, 4);
321
- const year = cleanInput.slice(4, 8);
322
- const hour = cleanInput.slice(8, 10);
323
- const minute = cleanInput.slice(10, 12);
324
- if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
325
- let result = (0, import_moment.default)(
326
- `${day}-${month}-${year} ${hour}:${minute}:00`,
327
- "DD-MM-YYYY HH:mm:ss"
328
- );
329
- if (!result.isValid()) return null;
330
- result = result.subtract(7, "hours");
331
- return result.format(dateTimeFormat);
332
- }
333
- return null;
334
- }
335
- if (cleanInput.length === 13) {
336
- const day = cleanInput.slice(0, 2);
337
- const month = cleanInput.slice(2, 4);
338
- const year = cleanInput.slice(4, 8);
339
- const hour = cleanInput.slice(8, 10);
340
- const minute = cleanInput.slice(10, 12);
341
- const second = cleanInput.slice(12, 13).padStart(2, "0");
342
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
343
- let result = (0, import_moment.default)(
344
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
345
- "DD-MM-YYYY HH:mm:ss"
346
- );
347
- if (!result.isValid()) return null;
348
- result = result.subtract(7, "hours");
349
- return result.format(dateTimeFormat);
350
- }
351
- return null;
352
- }
353
- if (cleanInput.length === 14) {
354
- const day = cleanInput.slice(0, 2);
355
- const month = cleanInput.slice(2, 4);
356
- const year = cleanInput.slice(4, 8);
357
- const hour = cleanInput.slice(8, 10);
358
- const minute = cleanInput.slice(10, 12);
359
- const second = cleanInput.slice(12, 14);
360
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
361
- let result = (0, import_moment.default)(
362
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
363
- "DD-MM-YYYY HH:mm:ss"
364
- );
365
- if (!result.isValid()) return null;
366
- result = result.subtract(7, "hours");
367
- return result.format(dateTimeFormat);
368
- }
369
- return null;
370
- }
371
- }
372
- const len = cleanInput.length;
373
- if (len === 1 || len === 2) {
374
- const paddedDay = cleanInput.padStart(2, "0");
375
- if (isValidDate(paddedDay, currentMonth, currentYear)) {
376
- return formatOutput(paddedDay, currentMonth, currentYear);
377
- }
378
- return null;
379
- }
380
- if (len === 3) {
381
- const day = cleanInput.slice(0, 2);
382
- const month = cleanInput.slice(2, 3).padStart(2, "0");
383
- if (isValidDate(day, month, currentYear)) {
384
- return formatOutput(day, month, currentYear);
385
- }
386
- return null;
387
- }
388
- if (len === 6) {
389
- const day = cleanInput.slice(0, 2);
390
- const month = cleanInput.slice(2, 4);
391
- let year = cleanInput.slice(4, 6);
392
- year = `20${year}`;
393
- if (parseInt(month) > 12) {
394
- if (isValidDate(day, currentMonth, currentYear)) {
395
- return formatOutput(day, currentMonth, currentYear);
396
- }
397
- return null;
398
- }
399
- if (isValidDate(day, month, year)) {
400
- return formatOutput(day, month, year);
401
- }
402
- return null;
403
- }
404
- if (len === 7) {
405
- return null;
406
- }
407
- if (len === 8) {
408
- const day = cleanInput.slice(0, 2);
409
- const month = cleanInput.slice(2, 4);
410
- const year = cleanInput.slice(4, 8);
411
- if (isValidDate(day, month, year)) {
412
- return formatOutput(day, month, year);
413
- }
414
- return null;
415
- }
416
- if (len > 8 && !isDateTime) {
417
- return null;
418
- }
419
- return null;
420
- };
421
199
 
422
200
  // src/utils.ts
423
201
  __reExport(utils_exports, require("@fctc/interface-logic/utils"), module.exports);
424
202
  // Annotate the CommonJS export names for ESM import in node:
425
203
  0 && (module.exports = {
426
204
  STORAGES,
205
+ combineContexts,
206
+ convertFieldsToArray,
427
207
  countSum,
428
- guessTypeFromUrl,
429
- isObjectEmpty,
208
+ getDateRange,
430
209
  languages,
431
210
  mergeButtons,
432
211
  setStorageItemAsync,
433
212
  useStorageState,
434
- validateAndParseDate,
435
213
  ...require("@fctc/interface-logic/utils")
436
214
  });