@fileverse-dev/formulajs 4.4.11-mod-19-patch-1 → 4.4.11-mod-19-patch-2
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 -2
- package/lib/browser/formula.min.js +1 -1
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +14 -3
- package/lib/esm/index.mjs +14 -3
- package/package.json +1 -1
- package/types/cjs/index.d.cts +3 -1
- package/types/esm/index.d.mts +3 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -73,9 +73,17 @@ function dateToSerial(date) {
|
|
|
73
73
|
return Math.ceil((date - d1900) / 86400000) + addOn
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
function formatDate(date) {
|
|
77
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
78
|
+
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-indexed
|
|
79
|
+
const year = date.getFullYear();
|
|
80
|
+
return `${day}/${month}/${year}`
|
|
81
|
+
}
|
|
82
|
+
|
|
76
83
|
var date = /*#__PURE__*/Object.freeze({
|
|
77
84
|
__proto__: null,
|
|
78
85
|
dateToSerial: dateToSerial,
|
|
86
|
+
formatDate: formatDate,
|
|
79
87
|
get returnSerial () { return returnSerial; },
|
|
80
88
|
serialToDate: serialToDate,
|
|
81
89
|
useDate: useDate,
|
|
@@ -7856,6 +7864,7 @@ function DAYS(end_date, start_date) {
|
|
|
7856
7864
|
* @returns
|
|
7857
7865
|
*/
|
|
7858
7866
|
function DAYS360(start_date, end_date, method) {
|
|
7867
|
+
debugger
|
|
7859
7868
|
method = parseBool(method || 'false');
|
|
7860
7869
|
start_date = parseDate(start_date);
|
|
7861
7870
|
end_date = parseDate(end_date);
|
|
@@ -7895,8 +7904,8 @@ function DAYS360(start_date, end_date, method) {
|
|
|
7895
7904
|
ed = end_date.getDate();
|
|
7896
7905
|
}
|
|
7897
7906
|
}
|
|
7898
|
-
|
|
7899
|
-
return
|
|
7907
|
+
const xxx = 360 * (end_date.getFullYear() - start_date.getFullYear()) + 30 * (em - sm) + (ed - sd);
|
|
7908
|
+
return xxx
|
|
7900
7909
|
}
|
|
7901
7910
|
|
|
7902
7911
|
/**
|
|
@@ -8238,8 +8247,10 @@ function TIMEVALUE(time_text) {
|
|
|
8238
8247
|
* @returns
|
|
8239
8248
|
*/
|
|
8240
8249
|
function TODAY() {
|
|
8250
|
+
debugger
|
|
8251
|
+
console.log({returnSerial});
|
|
8241
8252
|
const today = startOfDay(new Date());
|
|
8242
|
-
return returnSerial ?
|
|
8253
|
+
return returnSerial ? formatDate(today) : today
|
|
8243
8254
|
}
|
|
8244
8255
|
|
|
8245
8256
|
/**
|
package/lib/esm/index.mjs
CHANGED
|
@@ -71,9 +71,17 @@ function dateToSerial(date) {
|
|
|
71
71
|
return Math.ceil((date - d1900) / 86400000) + addOn
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
function formatDate(date) {
|
|
75
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
76
|
+
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-indexed
|
|
77
|
+
const year = date.getFullYear();
|
|
78
|
+
return `${day}/${month}/${year}`
|
|
79
|
+
}
|
|
80
|
+
|
|
74
81
|
var date = /*#__PURE__*/Object.freeze({
|
|
75
82
|
__proto__: null,
|
|
76
83
|
dateToSerial: dateToSerial,
|
|
84
|
+
formatDate: formatDate,
|
|
77
85
|
get returnSerial () { return returnSerial; },
|
|
78
86
|
serialToDate: serialToDate,
|
|
79
87
|
useDate: useDate,
|
|
@@ -7854,6 +7862,7 @@ function DAYS(end_date, start_date) {
|
|
|
7854
7862
|
* @returns
|
|
7855
7863
|
*/
|
|
7856
7864
|
function DAYS360(start_date, end_date, method) {
|
|
7865
|
+
debugger
|
|
7857
7866
|
method = parseBool(method || 'false');
|
|
7858
7867
|
start_date = parseDate(start_date);
|
|
7859
7868
|
end_date = parseDate(end_date);
|
|
@@ -7893,8 +7902,8 @@ function DAYS360(start_date, end_date, method) {
|
|
|
7893
7902
|
ed = end_date.getDate();
|
|
7894
7903
|
}
|
|
7895
7904
|
}
|
|
7896
|
-
|
|
7897
|
-
return
|
|
7905
|
+
const xxx = 360 * (end_date.getFullYear() - start_date.getFullYear()) + 30 * (em - sm) + (ed - sd);
|
|
7906
|
+
return xxx
|
|
7898
7907
|
}
|
|
7899
7908
|
|
|
7900
7909
|
/**
|
|
@@ -8236,8 +8245,10 @@ function TIMEVALUE(time_text) {
|
|
|
8236
8245
|
* @returns
|
|
8237
8246
|
*/
|
|
8238
8247
|
function TODAY() {
|
|
8248
|
+
debugger
|
|
8249
|
+
console.log({returnSerial});
|
|
8239
8250
|
const today = startOfDay(new Date());
|
|
8240
|
-
return returnSerial ?
|
|
8251
|
+
return returnSerial ? formatDate(today) : today
|
|
8241
8252
|
}
|
|
8242
8253
|
|
|
8243
8254
|
/**
|
package/package.json
CHANGED
package/types/cjs/index.d.cts
CHANGED
|
@@ -4080,7 +4080,7 @@ export namespace TINV {
|
|
|
4080
4080
|
*
|
|
4081
4081
|
* @returns
|
|
4082
4082
|
*/
|
|
4083
|
-
export function TODAY():
|
|
4083
|
+
export function TODAY(): string | Date;
|
|
4084
4084
|
/**
|
|
4085
4085
|
* Returns the transpose of an array.
|
|
4086
4086
|
*
|
|
@@ -4461,6 +4461,7 @@ declare var symbols: Readonly<{
|
|
|
4461
4461
|
declare var date: Readonly<{
|
|
4462
4462
|
__proto__: any;
|
|
4463
4463
|
dateToSerial: typeof dateToSerial;
|
|
4464
|
+
formatDate: typeof formatDate;
|
|
4464
4465
|
readonly returnSerial: boolean;
|
|
4465
4466
|
serialToDate: typeof serialToDate;
|
|
4466
4467
|
useDate: typeof useDate;
|
|
@@ -4559,6 +4560,7 @@ declare function NE(value1: any, value2: any, ...args: any[]): boolean | Error;
|
|
|
4559
4560
|
*/
|
|
4560
4561
|
declare function POW(base: any, exponent: any, ...args: any[]): any;
|
|
4561
4562
|
declare function dateToSerial(date: any): number;
|
|
4563
|
+
declare function formatDate(date: any): string;
|
|
4562
4564
|
declare function serialToDate(serial: any): Date;
|
|
4563
4565
|
declare function useDate(): void;
|
|
4564
4566
|
declare function useSerial(): void;
|
package/types/esm/index.d.mts
CHANGED
|
@@ -4080,7 +4080,7 @@ export namespace TINV {
|
|
|
4080
4080
|
*
|
|
4081
4081
|
* @returns
|
|
4082
4082
|
*/
|
|
4083
|
-
export function TODAY():
|
|
4083
|
+
export function TODAY(): string | Date;
|
|
4084
4084
|
/**
|
|
4085
4085
|
* Returns the transpose of an array.
|
|
4086
4086
|
*
|
|
@@ -4461,6 +4461,7 @@ declare var symbols: Readonly<{
|
|
|
4461
4461
|
declare var date: Readonly<{
|
|
4462
4462
|
__proto__: any;
|
|
4463
4463
|
dateToSerial: typeof dateToSerial;
|
|
4464
|
+
formatDate: typeof formatDate;
|
|
4464
4465
|
readonly returnSerial: boolean;
|
|
4465
4466
|
serialToDate: typeof serialToDate;
|
|
4466
4467
|
useDate: typeof useDate;
|
|
@@ -4559,6 +4560,7 @@ declare function NE(value1: any, value2: any, ...args: any[]): boolean | Error;
|
|
|
4559
4560
|
*/
|
|
4560
4561
|
declare function POW(base: any, exponent: any, ...args: any[]): any;
|
|
4561
4562
|
declare function dateToSerial(date: any): number;
|
|
4563
|
+
declare function formatDate(date: any): string;
|
|
4562
4564
|
declare function serialToDate(serial: any): Date;
|
|
4563
4565
|
declare function useDate(): void;
|
|
4564
4566
|
declare function useSerial(): void;
|