@fileverse-dev/formulajs 4.4.35 → 4.4.36
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 +31 -52
- package/lib/browser/formula.min.js +1 -1
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +28 -57
- package/lib/esm/index.mjs +28 -57
- package/package.json +1 -1
package/lib/browser/formula.js
CHANGED
|
@@ -8358,6 +8358,25 @@ function _typeof(o) {
|
|
|
8358
8358
|
var WEEK_STARTS = [ undefined, 0, 1, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, 1, 2, 3, 4, 5, 6, 0 ];
|
|
8359
8359
|
var WEEK_TYPES = [ [], [ 1, 2, 3, 4, 5, 6, 7 ], [ 7, 1, 2, 3, 4, 5, 6 ], [ 6, 0, 1, 2, 3, 4, 5 ], [], [], [], [], [], [], [], [ 7, 1, 2, 3, 4, 5, 6 ], [ 6, 7, 1, 2, 3, 4, 5 ], [ 5, 6, 7, 1, 2, 3, 4 ], [ 4, 5, 6, 7, 1, 2, 3 ], [ 3, 4, 5, 6, 7, 1, 2 ], [ 2, 3, 4, 5, 6, 7, 1 ], [ 1, 2, 3, 4, 5, 6, 7 ] ];
|
|
8360
8360
|
var WEEKEND_TYPES = [ [], [ 6, 0 ], [ 0, 1 ], [ 1, 2 ], [ 2, 3 ], [ 3, 4 ], [ 4, 5 ], [ 5, 6 ], undefined, undefined, undefined, [ 0, 0 ], [ 1, 1 ], [ 2, 2 ], [ 3, 3 ], [ 4, 4 ], [ 5, 5 ], [ 6, 6 ] ];
|
|
8361
|
+
var datePartition = function datePartition(date) {
|
|
8362
|
+
var pad = function pad(n) {
|
|
8363
|
+
return n.toString().padStart(2, "0");
|
|
8364
|
+
};
|
|
8365
|
+
var day = pad(date.getDate());
|
|
8366
|
+
var month = pad(date.getMonth() + 1);
|
|
8367
|
+
var year = date.getFullYear();
|
|
8368
|
+
var hours = pad(date.getHours());
|
|
8369
|
+
var minutes = pad(date.getMinutes());
|
|
8370
|
+
var seconds = pad(date.getSeconds());
|
|
8371
|
+
return {
|
|
8372
|
+
day: day,
|
|
8373
|
+
month: month,
|
|
8374
|
+
year: year,
|
|
8375
|
+
hours: hours,
|
|
8376
|
+
minutes: minutes,
|
|
8377
|
+
seconds: seconds
|
|
8378
|
+
};
|
|
8379
|
+
};
|
|
8361
8380
|
function DATE(year, month, day) {
|
|
8362
8381
|
var result;
|
|
8363
8382
|
year = parseNumber(year);
|
|
@@ -8370,12 +8389,7 @@ function _typeof(o) {
|
|
|
8370
8389
|
if (result.getFullYear() < 0) {
|
|
8371
8390
|
result = num;
|
|
8372
8391
|
}
|
|
8373
|
-
var
|
|
8374
|
-
return n.toString().padStart(2, "0");
|
|
8375
|
-
};
|
|
8376
|
-
var dayResult = pad(result.getDate());
|
|
8377
|
-
var monthResult = pad(result.getMonth() + 1);
|
|
8378
|
-
var yearResult = result.getFullYear();
|
|
8392
|
+
var _datePartition = datePartition(result), dayResult = _datePartition.day, monthResult = _datePartition.month, yearResult = _datePartition.year;
|
|
8379
8393
|
result = "".concat(dayResult, "/").concat(monthResult, "/").concat(yearResult);
|
|
8380
8394
|
}
|
|
8381
8395
|
return returnSerial ? dateToSerial(result) : result;
|
|
@@ -8535,12 +8549,7 @@ function _typeof(o) {
|
|
|
8535
8549
|
}
|
|
8536
8550
|
start_date.setDate(storedDay);
|
|
8537
8551
|
var widthoutSerial = start_date;
|
|
8538
|
-
var
|
|
8539
|
-
return n.toString().padStart(2, "0");
|
|
8540
|
-
};
|
|
8541
|
-
var dayResult = pad(widthoutSerial.getDate());
|
|
8542
|
-
var monthResult = pad(widthoutSerial.getMonth() + 1);
|
|
8543
|
-
var yearResult = widthoutSerial.getFullYear();
|
|
8552
|
+
var _datePartition2 = datePartition(widthoutSerial), dayResult = _datePartition2.day, monthResult = _datePartition2.month, yearResult = _datePartition2.year;
|
|
8544
8553
|
widthoutSerial = "".concat(dayResult, "/").concat(monthResult, "/").concat(yearResult);
|
|
8545
8554
|
return returnSerial ? dateToSerial(start_date) : widthoutSerial;
|
|
8546
8555
|
}
|
|
@@ -8555,12 +8564,7 @@ function _typeof(o) {
|
|
|
8555
8564
|
months = parseInt(months, 10);
|
|
8556
8565
|
var eoMonth = new Date(start_date.getFullYear(), start_date.getMonth() + months + 1, 0);
|
|
8557
8566
|
var widthoutSerial = eoMonth;
|
|
8558
|
-
var
|
|
8559
|
-
return n.toString().padStart(2, "0");
|
|
8560
|
-
};
|
|
8561
|
-
var dayResult = pad(widthoutSerial.getDate());
|
|
8562
|
-
var monthResult = pad(widthoutSerial.getMonth() + 1);
|
|
8563
|
-
var yearResult = widthoutSerial.getFullYear();
|
|
8567
|
+
var _datePartition3 = datePartition(widthoutSerial), dayResult = _datePartition3.day, monthResult = _datePartition3.month, yearResult = _datePartition3.year;
|
|
8564
8568
|
widthoutSerial = "".concat(dayResult, "/").concat(monthResult, "/").concat(yearResult);
|
|
8565
8569
|
return returnSerial ? dateToSerial(eoMonth) : widthoutSerial;
|
|
8566
8570
|
}
|
|
@@ -8587,15 +8591,7 @@ function _typeof(o) {
|
|
|
8587
8591
|
throw new Error("Invalid time_unit. Use 1 (sec), 2 (ms), or 3 (µs).");
|
|
8588
8592
|
}
|
|
8589
8593
|
var d = new Date(ms);
|
|
8590
|
-
var
|
|
8591
|
-
return n.toString().padStart(2, "0");
|
|
8592
|
-
};
|
|
8593
|
-
var day = pad(d.getDate());
|
|
8594
|
-
var month = pad(d.getMonth() + 1);
|
|
8595
|
-
var year = d.getFullYear();
|
|
8596
|
-
var hours = pad(d.getHours());
|
|
8597
|
-
var minutes = pad(d.getMinutes());
|
|
8598
|
-
var seconds = pad(d.getSeconds());
|
|
8594
|
+
var _datePartition4 = datePartition(d), day = _datePartition4.day, month = _datePartition4.month, year = _datePartition4.year, hours = _datePartition4.hours, minutes = _datePartition4.minutes, seconds = _datePartition4.seconds;
|
|
8599
8595
|
return "".concat(day, "/").concat(month, "/").concat(year, " ").concat(hours, ":").concat(minutes, ":").concat(seconds);
|
|
8600
8596
|
}
|
|
8601
8597
|
function SEQUENCE(rows) {
|
|
@@ -8603,27 +8599,18 @@ function _typeof(o) {
|
|
|
8603
8599
|
var start = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
8604
8600
|
var step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
8605
8601
|
var result = [];
|
|
8606
|
-
var
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
var dateToSerial = function dateToSerial(d) {
|
|
8611
|
-
var utcDate = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
|
|
8612
|
-
var gsEpoch = Date.UTC(1899, 11, 30);
|
|
8613
|
-
return (utcDate - gsEpoch) / (1e3 * 60 * 60 * 24);
|
|
8602
|
+
var isDateInput = function isDateInput(val) {
|
|
8603
|
+
if (val instanceof Date) return true;
|
|
8604
|
+
if (typeof val === "string" && !isNaN(Date.parse(val))) return true;
|
|
8605
|
+
return false;
|
|
8614
8606
|
};
|
|
8615
|
-
|
|
8607
|
+
var isDate = isDateInput(start);
|
|
8608
|
+
if (isDate) start = DATEVALUE(start);
|
|
8616
8609
|
for (var r = 0; r < rows; r++) {
|
|
8617
8610
|
var row = [];
|
|
8618
8611
|
for (var c = 0; c < columns; c++) {
|
|
8619
8612
|
var index = r * columns + c;
|
|
8620
|
-
|
|
8621
|
-
var d = new Date(start);
|
|
8622
|
-
d.setUTCDate(start.getUTCDate() + index * step);
|
|
8623
|
-
row.push(dateToSerial(d));
|
|
8624
|
-
} else {
|
|
8625
|
-
row.push(start + index * step);
|
|
8626
|
-
}
|
|
8613
|
+
row.push(start + index * step);
|
|
8627
8614
|
}
|
|
8628
8615
|
result.push(row);
|
|
8629
8616
|
}
|
|
@@ -8727,15 +8714,7 @@ function _typeof(o) {
|
|
|
8727
8714
|
var NETWORKDAYS_INTL = NETWORKDAYS.INTL;
|
|
8728
8715
|
function NOW() {
|
|
8729
8716
|
var d = new Date;
|
|
8730
|
-
var
|
|
8731
|
-
return n.toString().padStart(2, "0");
|
|
8732
|
-
};
|
|
8733
|
-
var day = pad(d.getDate());
|
|
8734
|
-
var month = pad(d.getMonth() + 1);
|
|
8735
|
-
var year = d.getFullYear();
|
|
8736
|
-
var hours = pad(d.getHours());
|
|
8737
|
-
var minutes = pad(d.getMinutes());
|
|
8738
|
-
var seconds = pad(d.getSeconds());
|
|
8717
|
+
var _datePartition5 = datePartition(d), day = _datePartition5.day, month = _datePartition5.month, year = _datePartition5.year, hours = _datePartition5.hours, minutes = _datePartition5.minutes, seconds = _datePartition5.seconds;
|
|
8739
8718
|
return returnSerial ? dateToSerial(d) : "".concat(day, "/").concat(month, "/").concat(year, " ").concat(hours, ":").concat(minutes, ":").concat(seconds);
|
|
8740
8719
|
}
|
|
8741
8720
|
function SECOND(serial_number) {
|