@fileverse-dev/formulajs 4.4.11-mod-19 → 4.4.11-mod-19-patch-1
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/browser/formula.js +15 -4
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +18 -3
- package/lib/esm/index.mjs +18 -3
- package/package.json +1 -1
- package/types/cjs/index.d.cts +1 -1
- package/types/esm/index.d.mts +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -549,10 +549,25 @@ function parseDate(date) {
|
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
if (typeof date === 'string') {
|
|
552
|
-
|
|
552
|
+
// Check for YYYY-MM-DD (ISO format)
|
|
553
|
+
if (/^\d{4}-\d{1,2}-\d{1,2}$/.test(date)) {
|
|
554
|
+
return new Date(date + 'T00:00:00.000')
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// Check for DD/MM/YYYY
|
|
558
|
+
const match = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(date);
|
|
559
|
+
if (match) {
|
|
560
|
+
const [, day, month, year] = match.map(Number);
|
|
561
|
+
const d = new Date(year, month - 1, day);
|
|
562
|
+
if (!isNaN(d)) {
|
|
563
|
+
return d
|
|
564
|
+
}
|
|
565
|
+
}
|
|
553
566
|
|
|
554
|
-
|
|
555
|
-
|
|
567
|
+
// Fallback for other string formats
|
|
568
|
+
const parsed = new Date(date);
|
|
569
|
+
if (!isNaN(parsed)) {
|
|
570
|
+
return parsed
|
|
556
571
|
}
|
|
557
572
|
}
|
|
558
573
|
|
package/lib/esm/index.mjs
CHANGED
|
@@ -547,10 +547,25 @@ function parseDate(date) {
|
|
|
547
547
|
}
|
|
548
548
|
|
|
549
549
|
if (typeof date === 'string') {
|
|
550
|
-
|
|
550
|
+
// Check for YYYY-MM-DD (ISO format)
|
|
551
|
+
if (/^\d{4}-\d{1,2}-\d{1,2}$/.test(date)) {
|
|
552
|
+
return new Date(date + 'T00:00:00.000')
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
// Check for DD/MM/YYYY
|
|
556
|
+
const match = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.exec(date);
|
|
557
|
+
if (match) {
|
|
558
|
+
const [, day, month, year] = match.map(Number);
|
|
559
|
+
const d = new Date(year, month - 1, day);
|
|
560
|
+
if (!isNaN(d)) {
|
|
561
|
+
return d
|
|
562
|
+
}
|
|
563
|
+
}
|
|
551
564
|
|
|
552
|
-
|
|
553
|
-
|
|
565
|
+
// Fallback for other string formats
|
|
566
|
+
const parsed = new Date(date);
|
|
567
|
+
if (!isNaN(parsed)) {
|
|
568
|
+
return parsed
|
|
554
569
|
}
|
|
555
570
|
}
|
|
556
571
|
|
package/package.json
CHANGED
package/types/cjs/index.d.cts
CHANGED
|
@@ -993,7 +993,7 @@ export function DAVERAGE(database: any, field: any, criteria: any): number | Err
|
|
|
993
993
|
* @param {*} serial_number The date of the day you are trying to find.
|
|
994
994
|
* @returns
|
|
995
995
|
*/
|
|
996
|
-
export function DAY(serial_number: any):
|
|
996
|
+
export function DAY(serial_number: any): number | Error;
|
|
997
997
|
/**
|
|
998
998
|
* Returns the number of days between two dates.
|
|
999
999
|
*
|
package/types/esm/index.d.mts
CHANGED
|
@@ -993,7 +993,7 @@ export function DAVERAGE(database: any, field: any, criteria: any): number | Err
|
|
|
993
993
|
* @param {*} serial_number The date of the day you are trying to find.
|
|
994
994
|
* @returns
|
|
995
995
|
*/
|
|
996
|
-
export function DAY(serial_number: any):
|
|
996
|
+
export function DAY(serial_number: any): number | Error;
|
|
997
997
|
/**
|
|
998
998
|
* Returns the number of days between two dates.
|
|
999
999
|
*
|