@fileverse-dev/formulajs 4.4.11-mod-6 → 4.4.11-mod-7

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/cjs/index.cjs CHANGED
@@ -26,6 +26,62 @@ var errors = /*#__PURE__*/Object.freeze({
26
26
  value: value
27
27
  });
28
28
 
29
+ let returnSerial = false;
30
+
31
+ const d1900 = new Date(Date.UTC(1900, 0, 1));
32
+
33
+ function useSerial() {
34
+ returnSerial = true;
35
+ }
36
+
37
+ function useDate() {
38
+ returnSerial = false;
39
+ }
40
+
41
+ function serialToDate(serial) {
42
+ if (serial < 60) {
43
+ serial += 1;
44
+ }
45
+
46
+ const utc_days = Math.floor(serial - 25569);
47
+ const utc_value = utc_days * 86400;
48
+ const date_info = new Date(utc_value * 1000);
49
+ const fractional_day = serial - Math.floor(serial) + 0.0000001;
50
+
51
+ let total_seconds = Math.floor(86400 * fractional_day);
52
+
53
+ const seconds = total_seconds % 60;
54
+
55
+ total_seconds -= seconds;
56
+
57
+ const hours = Math.floor(total_seconds / (60 * 60));
58
+ const minutes = Math.floor(total_seconds / 60) % 60;
59
+ let days = date_info.getUTCDate();
60
+ let month = date_info.getUTCMonth();
61
+
62
+ if (serial >= 60 && serial < 61) {
63
+ days = 29;
64
+ month = 1;
65
+ }
66
+
67
+ return new Date(date_info.getUTCFullYear(), month, days, hours, minutes, seconds)
68
+ }
69
+
70
+ function dateToSerial(date) {
71
+ const addOn = date > -22038912e5 ? 2 : 1;
72
+
73
+ return Math.ceil((date - d1900) / 86400000) + addOn
74
+ }
75
+
76
+ var date = /*#__PURE__*/Object.freeze({
77
+ __proto__: null,
78
+ dateToSerial: dateToSerial,
79
+ get returnSerial () { return returnSerial; },
80
+ serialToDate: serialToDate,
81
+ useDate: useDate,
82
+ useSerial: useSerial
83
+ });
84
+
29
85
  const defaultOperator = '=';
30
86
  const validSymbols = ['>', '>=', '<', '<=', '=', '<>'];
31
87
  const _TOKEN_TYPE_OPERATOR = 'operator';
@@ -444,35 +500,6 @@ function numbers() {
444
500
  return possibleNumbers.filter((el) => typeof el === 'number')
445
501
  }
446
502
 
447
- function serialNumberToDate(serial) {
448
- if (serial < 60) {
449
- serial += 1;
450
- }
451
-
452
- const utc_days = Math.floor(serial - 25569);
453
- const utc_value = utc_days * 86400;
454
- const date_info = new Date(utc_value * 1000);
455
- const fractional_day = serial - Math.floor(serial) + 0.0000001;
456
-
457
- let total_seconds = Math.floor(86400 * fractional_day);
458
-
459
- const seconds = total_seconds % 60;
460
-
461
- total_seconds -= seconds;
462
-
463
- const hours = Math.floor(total_seconds / (60 * 60));
464
- const minutes = Math.floor(total_seconds / 60) % 60;
465
- let days = date_info.getUTCDate();
466
- let month = date_info.getUTCMonth();
467
-
468
- if (serial >= 60 && serial < 61) {
469
- days = 29;
470
- month = 1;
471
- }
472
-
473
- return new Date(date_info.getUTCFullYear(), month, days, hours, minutes, seconds)
474
- }
475
-
476
503
  // Parsers
477
504
  function parseBool(bool) {
478
505
  if (typeof bool === 'boolean') {
@@ -518,7 +545,7 @@ function parseDate(date) {
518
545
  return num
519
546
  }
520
547
 
521
- return serialNumberToDate(d)
548
+ return serialToDate(d)
522
549
  }
523
550
 
524
551
  if (typeof date === 'string') {
@@ -679,20 +706,6 @@ function isDefined(arg) {
679
706
  return arg !== undefined && arg !== null
680
707
  }
681
708
 
682
- // TODO
683
- /**
684
- * -- Not implemented --
685
- *
686
- * Returns information about the formatting, location, or contents of a value.
687
- *
688
- * Category: Information
689
- *
690
- * @returns
691
- */
692
- function CELL() {
693
- throw new Error('CELL is not implemented')
694
- }
695
-
696
709
  const ERROR = {};
697
710
 
698
711
  ERROR.TYPE = (error_val) => {
@@ -718,20 +731,6 @@ ERROR.TYPE = (error_val) => {
718
731
  return na
719
732
  };
720
733
 
721
- // TODO
722
- /**
723
- * -- Not implemented --
724
- *
725
- * Returns information about the current operating environment.
726
- *
727
- * Category: Information
728
- *
729
- * @returns
730
- */
731
- function INFO() {
732
- throw new Error('INFO is not implemented')
733
- }
734
-
735
734
  /**
736
735
  * Returns TRUE if the value is blank.
737
736
  *
@@ -783,21 +782,6 @@ function ISEVEN(number) {
783
782
  return !(Math.floor(Math.abs(number)) & 1)
784
783
  }
785
784
 
786
- // TODO
787
- /**
788
- * -- Not implemented --
789
- *
790
- * Returns TRUE if there is a reference to a value that contains a formula.
791
- *
792
- * Category: Information
793
- *
794
- * @param {*} reference Reference is a reference to the value you want to test. Reference can be a value reference, a formula, or a name that refers to a value.
795
- * @returns
796
- */
797
- function ISFORMULA() {
798
- throw new Error('ISFORMULA is not implemented')
799
- }
800
-
801
785
  /**
802
786
  * Returns TRUE if the value is a logical value.
803
787
  *
@@ -858,21 +842,6 @@ function ISODD(value) {
858
842
  return !!(Math.floor(Math.abs(value)) & 1)
859
843
  }
860
844
 
861
- // TODO
862
- /**
863
- * -- Not implemented --
864
- *
865
- * Returns TRUE if the value is a reference.
866
- *
867
- * Category: Information
868
- *
869
- * @param {*} value The value that you want tested. The value argument can be a blank (empty value), error, logical value, text, number, or reference value, or a name referring to any of these.
870
- * @returns
871
- */
872
- function ISREF() {
873
- throw new Error('ISREF is not implemented')
874
- }
875
-
876
845
  /**
877
846
  * Returns TRUE if the value is text.
878
847
  *
@@ -928,36 +897,6 @@ function NA() {
928
897
  return na
929
898
  }
930
899
 
931
- // TODO
932
- /**
933
- * -- Not implemented --
934
- *
935
- * Returns the sheet number of the referenced sheet.
936
- *
937
- * Category: Information
938
- *
939
- * @param {*} value Optional. Value is the name of a sheet or a reference for which you want the sheet number. If value is omitted, SHEET returns the number of the sheet that contains the function.
940
- * @returns
941
- */
942
- function SHEET() {
943
- throw new Error('SHEET is not implemented')
944
- }
945
-
946
- // TODO
947
- /**
948
- * -- Not implemented --
949
- *
950
- * Returns the number of sheets in a reference.
951
- *
952
- * Category: Information
953
- *
954
- * @param {*} reference Optional. Reference is a reference for which you want to know the number of sheets it contains. If Reference is omitted, SHEETS returns the number of sheets in the workbook that contains the function.
955
- * @returns
956
- */
957
- function SHEETS() {
958
- throw new Error('SHEETS is not implemented')
959
- }
960
-
961
900
  /**
962
901
  * Returns a number indicating the data type of a value.
963
902
  *
@@ -1427,36 +1366,6 @@ function VLOOKUP(lookup_value, table_array, col_index_num, range_lookup) {
1427
1366
  return result
1428
1367
  }
1429
1368
 
1430
- // TODO
1431
- /**
1432
- * -- Not implemented --
1433
- *
1434
- * Changes full-width (double-byte) English letters or katakana within a character string to half-width (single-byte) characters.
1435
- *
1436
- * Category: Text
1437
- *
1438
- * @param {*} text The text or a reference to a value that contains the text you want to change. If text does not contain any full-width letters, text is not changed.
1439
- * @returns
1440
- */
1441
- function ASC() {
1442
- throw new Error('ASC is not implemented')
1443
- }
1444
-
1445
- // TODO
1446
- /**
1447
- * -- Not implemented --
1448
- *
1449
- * Converts a number to text, using the ß (baht) currency format.
1450
- *
1451
- * Category: Text
1452
- *
1453
- * @param {*} number A number you want to convert to text, or a reference to a value containing a number, or a formula that evaluates to a number.
1454
- * @returns
1455
- */
1456
- function BAHTTEXT() {
1457
- throw new Error('BAHTTEXT is not implemented')
1458
- }
1459
-
1460
1369
  /**
1461
1370
  * Returns the character specified by the code number.
1462
1371
  *
@@ -1553,21 +1462,6 @@ function CONCATENATE() {
1553
1462
 
1554
1463
  const CONCAT = CONCATENATE;
1555
1464
 
1556
- // TODO
1557
- /**
1558
- * -- Not implemented --
1559
- *
1560
- * Changes half-width (single-byte) English letters or katakana within a character string to full-width (double-byte) characters.
1561
- *
1562
- * Category: Text
1563
- *
1564
- * @param {*} text The text or a reference to a value that contains the text you want to change. If text does not contain any half-width English letters or katakana, text is not changed.
1565
- * @returns
1566
- */
1567
- function DBCS() {
1568
- throw new Error('DBCS is not implemented')
1569
- }
1570
-
1571
1465
  /**
1572
1466
  * Converts a number to text, using the $ (dollar) currency format.
1573
1467
  *
@@ -1824,14 +1718,6 @@ function NUMBERVALUE(text, decimal_separator, group_separator) {
1824
1718
  return Number(text.replace(decimal_separator, '.').replace(group_separator, ''))
1825
1719
  }
1826
1720
 
1827
- // TODO
1828
- /**
1829
- * -- Not implemented --
1830
- */
1831
- function PRONETIC() {
1832
- throw new Error('PRONETIC is not implemented')
1833
- }
1834
-
1835
1721
  /**
1836
1722
  * Capitalizes the first letter in each word of a text value.
1837
1723
  *
@@ -7623,7 +7509,6 @@ var symbols = /*#__PURE__*/Object.freeze({
7623
7509
  POW: POW
7624
7510
  });
7625
7511
 
7626
- const d1900 = new Date(Date.UTC(1900, 0, 1));
7627
7512
  const WEEK_STARTS = [
7628
7513
  undefined,
7629
7514
  0,
@@ -7713,7 +7598,7 @@ function DATE(year, month, day) {
7713
7598
  }
7714
7599
  }
7715
7600
 
7716
- return result
7601
+ return returnSerial ? dateToSerial(result) : result
7717
7602
  }
7718
7603
 
7719
7604
  /**
@@ -7819,7 +7704,9 @@ function DATEVALUE(date_text) {
7819
7704
  return value
7820
7705
  }
7821
7706
 
7822
- return new Date(date_text)
7707
+ const dateValue = new Date(date_text);
7708
+
7709
+ return returnSerial ? dateToSerial(dateValue) : dateValue
7823
7710
  }
7824
7711
 
7825
7712
  /**
@@ -7868,7 +7755,7 @@ function DAYS(end_date, start_date) {
7868
7755
  return start_date
7869
7756
  }
7870
7757
 
7871
- return serial(startOfDay(end_date)) - serial(startOfDay(start_date))
7758
+ return dateToSerial(startOfDay(end_date)) - dateToSerial(startOfDay(start_date))
7872
7759
  }
7873
7760
 
7874
7761
  /**
@@ -7968,7 +7855,7 @@ function EDATE(start_date, months) {
7968
7855
 
7969
7856
  start_date.setDate(storedDay);
7970
7857
 
7971
- return start_date
7858
+ return returnSerial ? dateToSerial(start_date) : start_date
7972
7859
  }
7973
7860
 
7974
7861
  /**
@@ -7993,7 +7880,9 @@ function EOMONTH(start_date, months) {
7993
7880
 
7994
7881
  months = parseInt(months, 10);
7995
7882
 
7996
- return new Date(start_date.getFullYear(), start_date.getMonth() + months + 1, 0)
7883
+ const eoMonth = new Date(start_date.getFullYear(), start_date.getMonth() + months + 1, 0);
7884
+
7885
+ return returnSerial ? dateToSerial(eoMonth) : eoMonth
7997
7886
  }
7998
7887
 
7999
7888
  /**
@@ -8189,7 +8078,7 @@ NETWORKDAYS.INTL = (start_date, end_date, weekend, holidays) => {
8189
8078
  * @returns
8190
8079
  */
8191
8080
  function NOW() {
8192
- return new Date()
8081
+ return returnSerial ? dateToSerial(new Date()) : new Date()
8193
8082
  }
8194
8083
 
8195
8084
  /**
@@ -8262,7 +8151,8 @@ function TIMEVALUE(time_text) {
8262
8151
  * @returns
8263
8152
  */
8264
8153
  function TODAY() {
8265
- return startOfDay(new Date())
8154
+ const today = startOfDay(new Date());
8155
+ return returnSerial ? dateToSerial(today) : today
8266
8156
  }
8267
8157
 
8268
8158
  /**
@@ -8542,12 +8432,6 @@ function YEARFRAC(start_date, end_date, basis) {
8542
8432
  }
8543
8433
  }
8544
8434
 
8545
- function serial(date) {
8546
- const addOn = date > -22038912e5 ? 2 : 1;
8547
-
8548
- return Math.ceil((date - d1900) / 86400000) + addOn
8549
- }
8550
-
8551
8435
  function isValidBinaryNumber(number) {
8552
8436
  return /^[01]{1,10}$/.test(number)
8553
8437
  }
@@ -9483,22 +9367,6 @@ function ERF(lower_limit, upper_limit) {
9483
9367
  return jStat.erf(lower_limit)
9484
9368
  }
9485
9369
 
9486
- // TODO
9487
-
9488
- /**
9489
- * -- Not implemented --
9490
- *
9491
- * Returns the error function.
9492
- *
9493
- * Category: Engineering
9494
- *
9495
- * @param {*} x The lower bound for integrating ERF.PRECISE.
9496
- * @returns
9497
- */
9498
- ERF.PRECISE = () => {
9499
- throw new Error('ERF.PRECISE is not implemented')
9500
- };
9501
-
9502
9370
  /**
9503
9371
  * Returns the complementary error function.
9504
9372
  *
@@ -9516,22 +9384,6 @@ function ERFC(x) {
9516
9384
  return jStat.erfc(x)
9517
9385
  }
9518
9386
 
9519
- // TODO
9520
-
9521
- /**
9522
- * -- Not implemented --
9523
- *
9524
- * Returns the complementary ERF function integrated between x and infinity.
9525
- *
9526
- * Category: Engineering
9527
- *
9528
- * @param {*} x The lower bound for integrating ERFC.PRECISE.
9529
- * @returns
9530
- */
9531
- ERFC.PRECISE = () => {
9532
- throw new Error('ERFC.PRECISE is not implemented')
9533
- };
9534
-
9535
9387
  /**
9536
9388
  * Tests whether a number is greater than a threshold value.
9537
9389
  *
@@ -11304,85 +11156,6 @@ function ACCRINT(issue, first_interest, settlement, rate, par, frequency, basis)
11304
11156
  return par * rate * YEARFRAC(issue, settlement, basis)
11305
11157
  }
11306
11158
 
11307
- // TODO
11308
- /**
11309
- * -- Not implemented --
11310
- *
11311
- * Returns the accrued interest for a security that pays interest at maturity.
11312
- *
11313
- * Category: Financial
11314
- *
11315
- * @param {*} issue The security's issue date.
11316
- * @param {*} settlement The security's maturity date.
11317
- * @param {*} rate The security's annual coupon rate.
11318
- * @param {*} par The security's par value. If you omit par, ACCRINTM uses $1,000.
11319
- * @param {*} basis Optional. The type of day count basis to use.
11320
- * @returns
11321
- */
11322
- function ACCRINTM() {
11323
- throw new Error('ACCRINTM is not implemented')
11324
- }
11325
-
11326
- // TODO
11327
- /**
11328
- * -- Not implemented --
11329
- *
11330
- * Returns the depreciation for each accounting period by using a depreciation coefficient.
11331
- *
11332
- * Category: Financial
11333
- *
11334
- * @param {*} cost The cost of the asset.
11335
- * @param {*} date_purchased The date of the purchase of the asset.
11336
- * @param {*} first_period The date of the end of the first period.
11337
- * @param {*} salvage The salvage value at the end of the life of the asset.
11338
- * @param {*} period The period.
11339
- * @param {*} rate The rate of depreciation.
11340
- * @param {*} basis Optional. The year basis to be used.
11341
- * @returns
11342
- */
11343
- function AMORDEGRC() {
11344
- throw new Error('AMORDEGRC is not implemented')
11345
- }
11346
-
11347
- // TODO
11348
- /**
11349
- * -- Not implemented --
11350
- *
11351
- * Returns the depreciation for each accounting period.
11352
- *
11353
- * Category: Financial
11354
- *
11355
- * @param {*} cost The cost of the asset.
11356
- * @param {*} date_purchased The date of the purchase of the asset.
11357
- * @param {*} first_period The date of the end of the first period.
11358
- * @param {*} salvage The salvage value at the end of the life of the asset.
11359
- * @param {*} period The period.
11360
- * @param {*} rate The rate of depreciation.
11361
- * @param {*} basis Optional. The year basis to be used.
11362
- * @returns
11363
- */
11364
- function AMORLINC() {
11365
- throw new Error('AMORLINC is not implemented')
11366
- }
11367
-
11368
- // TODO
11369
- /**
11370
- * -- Not implemented --
11371
- *
11372
- * Returns the number of days from the beginning of the coupon period to the settlement date.
11373
- *
11374
- * Category: Financial
11375
- *
11376
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
11377
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
11378
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
11379
- * @param {*} basis Optional. The type of day count basis to use.
11380
- * @returns
11381
- */
11382
- function COUPDAYBS() {
11383
- throw new Error('COUPDAYBS is not implemented')
11384
- }
11385
-
11386
11159
  /**
11387
11160
  *
11388
11161
  * Returns the number of days in the coupon period that contains the settlement date.
@@ -11437,78 +11210,6 @@ function COUPDAYS(settlement, maturity, frequency, basis) {
11437
11210
  return numOfDays / frequency
11438
11211
  }
11439
11212
 
11440
- // TODO
11441
- /**
11442
- * -- Not implemented --
11443
- *
11444
- * Returns the number of days from the settlement date to the next coupon date.
11445
- *
11446
- * Category: Financial
11447
- *
11448
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
11449
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
11450
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
11451
- * @param {*} basis Optional. The type of day count basis to use.
11452
- * @returns
11453
- */
11454
- function COUPDAYSNC() {
11455
- throw new Error('COUPDAYSNC is not implemented')
11456
- }
11457
-
11458
- // TODO
11459
- /**
11460
- * -- Not implemented --
11461
- *
11462
- * Returns the next coupon date after the settlement date.
11463
- *
11464
- * Category: Financial
11465
- *
11466
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
11467
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
11468
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
11469
- * @param {*} basis Optional. The type of day count basis to use.
11470
- * @returns
11471
- */
11472
- function COUPNCD() {
11473
- throw new Error('COUPNCD is not implemented')
11474
- }
11475
-
11476
- // TODO
11477
- /**
11478
- * -- Not implemented --
11479
- *
11480
- * Returns the number of coupons payable between the settlement date and maturity date.
11481
- *
11482
- * Category: Financial
11483
- *
11484
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
11485
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
11486
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
11487
- * @param {*} basis Optional. The type of day count basis to use.
11488
- * @returns
11489
- */
11490
- function COUPNUM() {
11491
- throw new Error('COUPNUM is not implemented')
11492
- }
11493
-
11494
- // TODO
11495
- /**
11496
- * -- Not implemented --
11497
- *
11498
- * Returns the previous coupon date before the settlement date.
11499
- *
11500
- * Category: Financial
11501
- *
11502
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
11503
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
11504
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
11505
- * @param {*} basis Optional. The type of day count basis to use.
11506
- * @returns
11507
- */
11508
- function COUPPCD() {
11509
- throw new Error('COUPPCD is not implemented')
11510
- }
11511
-
11512
11213
  /**
11513
11214
  * Returns the cumulative interest paid between two periods.
11514
11215
  *
@@ -11900,26 +11601,6 @@ function DOLLARFR(decimal_dollar, fraction) {
11900
11601
  return result
11901
11602
  }
11902
11603
 
11903
- // TODO
11904
- /**
11905
- * -- Not implemented --
11906
- *
11907
- * Returns the annual duration of a security with periodic interest payments.
11908
- *
11909
- * Category: Financial
11910
- *
11911
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
11912
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
11913
- * @param {*} coupon The security's annual coupon rate.
11914
- * @param {*} yld The security's annual yield.
11915
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
11916
- * @param {*} basis Optional. The type of day count basis to use.
11917
- * @returns
11918
- */
11919
- function DURATION() {
11920
- throw new Error('DURATION is not implemented')
11921
- }
11922
-
11923
11604
  /**
11924
11605
  * Returns the effective annual interest rate.
11925
11606
  *
@@ -12024,25 +11705,6 @@ function FVSCHEDULE(principal, schedule) {
12024
11705
  return future
12025
11706
  }
12026
11707
 
12027
- // TODO
12028
- /**
12029
- * -- Not implemented --
12030
- *
12031
- * Returns the interest rate for a fully invested security.
12032
- *
12033
- * Category: Financial
12034
- *
12035
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
12036
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
12037
- * @param {*} investment The amount invested in the security.
12038
- * @param {*} redemption The amount to be received at maturity.
12039
- * @param {*} basis Optional. The type of day count basis to use.
12040
- * @returns
12041
- */
12042
- function INTRATE() {
12043
- throw new Error('INTRATE is not implemented')
12044
- }
12045
-
12046
11708
  /**
12047
11709
  * Returns the interest payment for an investment for a given period.
12048
11710
  *
@@ -12297,26 +11959,6 @@ function ISPMT(rate, per, nper, pv) {
12297
11959
  return pv * rate * (per / nper - 1)
12298
11960
  }
12299
11961
 
12300
- // TODO
12301
- /**
12302
- * -- Not implemented --
12303
- *
12304
- * Returns the Macauley modified duration for a security with an assumed par value of $100.
12305
- *
12306
- * Category: Financial
12307
- *
12308
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
12309
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
12310
- * @param {*} coupon The security's annual coupon rate.
12311
- * @param {*} yld The security's annual yield.
12312
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
12313
- * @param {*} basis Optional. The type of day count basis to use.
12314
- * @returns
12315
- */
12316
- function MDURATION() {
12317
- throw new Error('MDURATION is not implemented')
12318
- }
12319
-
12320
11962
  /**
12321
11963
  * Returns the internal rate of return where positive and negative cash flows are financed at different rates.
12322
11964
  *
@@ -12460,96 +12102,6 @@ function NPV() {
12460
12102
  return value
12461
12103
  }
12462
12104
 
12463
- // TODO
12464
- /**
12465
- * -- Not implemented --
12466
- *
12467
- * Returns the price per $100 face value of a security with an odd first period.
12468
- *
12469
- * Category: Financial
12470
- *
12471
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
12472
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
12473
- * @param {*} issue The security's issue date.
12474
- * @param {*} first_coupon The security's first coupon date.
12475
- * @param {*} rate The security's interest rate.
12476
- * @param {*} yld The security's annual yield.
12477
- * @param {*} redemption The security's redemption value per $100 face value.
12478
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
12479
- * @param {*} basis Optional. The type of day count basis to use.
12480
- * @returns
12481
- */
12482
- function ODDFPRICE() {
12483
- throw new Error('ODDFPRICE is not implemented')
12484
- }
12485
-
12486
- // TODO
12487
- /**
12488
- * -- Not implemented --
12489
- *
12490
- * Returns the yield of a security with an odd first period.
12491
- *
12492
- * Category: Financial
12493
- *
12494
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
12495
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
12496
- * @param {*} issue The security's issue date.
12497
- * @param {*} first_coupon The security's first coupon date.
12498
- * @param {*} rate The security's interest rate.
12499
- * @param {*} pr The security's price.
12500
- * @param {*} redemption The security's redemption value per $100 face value.
12501
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
12502
- * @param {*} basis Optional. The type of day count basis to use.
12503
- * @returns
12504
- */
12505
- function ODDFYIELD() {
12506
- throw new Error('ODDFYIELD is not implemented')
12507
- }
12508
-
12509
- // TODO
12510
- /**
12511
- * -- Not implemented --
12512
- *
12513
- * Returns the price per $100 face value of a security with an odd last period.
12514
- *
12515
- * Category: Financial
12516
- *
12517
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
12518
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
12519
- * @param {*} last_interest The security's last coupon date.
12520
- * @param {*} rate The security's interest rate.
12521
- * @param {*} yld The security's annual yield.
12522
- * @param {*} redemption The security's redemption value per $100 face value.
12523
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
12524
- * @param {*} basis Optional. The type of day count basis to use.
12525
- * @returns
12526
- */
12527
- function ODDLPRICE() {
12528
- throw new Error('ODDLPRICE is not implemented')
12529
- }
12530
-
12531
- // TODO
12532
- /**
12533
- * -- Not implemented --
12534
- *
12535
- * Returns the yield of a security with an odd last period.
12536
- *
12537
- * Category: Financial
12538
- *
12539
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
12540
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
12541
- * @param {*} last_interest The security's last coupon date.
12542
- * @param {*} rate The security's interest rate
12543
- * @param {*} pr The security's price.
12544
- * @param {*} redemption The security's redemption value per $100 face value.
12545
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
12546
- * @param {*} basis Optional. The type of day count basis to use.
12547
- * @returns
12548
- */
12549
- function ODDLYIELD() {
12550
- throw new Error('ODDLYIELD is not implemented')
12551
- }
12552
-
12553
12105
  /**
12554
12106
  * Returns the number of periods required by an investment to reach a specified value.
12555
12107
  *
@@ -12652,27 +12204,6 @@ function PPMT(rate, per, nper, pv, fv, type) {
12652
12204
  return PMT(rate, nper, pv, fv, type) - IPMT(rate, per, nper, pv, fv, type)
12653
12205
  }
12654
12206
 
12655
- // TODO
12656
- /**
12657
- * -- Not implemented --
12658
- *
12659
- * Returns the price per $100 face value of a security that pays periodic interest.
12660
- *
12661
- * Category: Financial
12662
- *
12663
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
12664
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
12665
- * @param {*} rate The security's annual coupon rate.
12666
- * @param {*} yld The security's annual yield.
12667
- * @param {*} redemption The security's redemption value per $100 face value.
12668
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
12669
- * @param {*} basis Optional. The type of day count basis to use.
12670
- * @returns
12671
- */
12672
- function PRICE() {
12673
- throw new Error('PRICE is not implemented')
12674
- }
12675
-
12676
12207
  /**
12677
12208
  * Returns the price per $100 face value of a discounted security.
12678
12209
  *
@@ -12735,26 +12266,6 @@ function PRICEDISC(settlement, maturity, discount, redemption, basis) {
12735
12266
  return redemption - (discount * redemption * diff) / basisVal
12736
12267
  }
12737
12268
 
12738
- // TODO
12739
- /**
12740
- * -- Not implemented --
12741
- *
12742
- * Returns the price per $100 face value of a security that pays interest at maturity.
12743
- *
12744
- * Category: Financial
12745
- *
12746
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
12747
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
12748
- * @param {*} issue The security's issue date, expressed as a serial date number.
12749
- * @param {*} rate The security's interest rate at date of issue.
12750
- * @param {*} yld The security's annual yield.
12751
- * @param {*} basis Optional. The type of day count basis to use.
12752
- * @returns
12753
- */
12754
- function PRICEMAT() {
12755
- throw new Error('PRICEMAT is not implemented')
12756
- }
12757
-
12758
12269
  /**
12759
12270
  * Returns the present value of an investment.
12760
12271
  *
@@ -12858,25 +12369,6 @@ function RATE(nper, pmt, pv, fv, type, guess) {
12858
12369
  return rate
12859
12370
  }
12860
12371
 
12861
- // TODO
12862
- /**
12863
- * -- Not implemented --
12864
- *
12865
- * Returns the amount received at maturity for a fully invested security.
12866
- *
12867
- * Category: Financial
12868
- *
12869
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
12870
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
12871
- * @param {*} investment The amount invested in the security.
12872
- * @param {*} discount The security's discount rate.
12873
- * @param {*} basis Optional. The type of day count basis to use.
12874
- * @returns
12875
- */
12876
- function RECEIVED() {
12877
- throw new Error('RECEIVED is not implemented')
12878
- }
12879
-
12880
12372
  /**
12881
12373
  * Returns an equivalent interest rate for the growth of an investment.
12882
12374
  *
@@ -13086,29 +12578,6 @@ function TBILLYIELD(settlement, maturity, pr) {
13086
12578
  return ((100 - pr) * 360) / (pr * DAYS360(settlement, maturity, false))
13087
12579
  }
13088
12580
 
13089
- // TODO
13090
- /**
13091
- * -- Not implemented --
13092
- *
13093
- * Returns the depreciation of an asset for a specified or partial period by using a declining balance method.
13094
- *
13095
- * Category: Financial
13096
- *
13097
- * @param {*} cost The initial cost of the asset.
13098
- * @param {*} salvage The value at the end of the depreciation (sometimes called the salvage value of the asset). This value can be 0.
13099
- * @param {*} life The number of periods over which the asset is depreciated (sometimes called the useful life of the asset).
13100
- * @param {*} start_period The starting period for which you want to calculate the depreciation. Start_period must use the same units as life.
13101
- * @param {*} end_period The ending period for which you want to calculate the depreciation. End_period must use the same units as life.
13102
- * @param {*} factor Optional. The rate at which the balance declines. If factor is omitted, it is assumed to be 2 (the double-declining balance method). Change factor if you do not want to use the double-declining balance method. For a description of the double-declining balance method, see DDB.
13103
- * @param {*} no_switch Optional. A logical value specifying whether to switch to straight-line depreciation when depreciation is greater than the declining balance calculation.
13104
- - If no_switch is TRUE, Microsoft Excel does not switch to straight-line depreciation even when the depreciation is greater than the declining balance calculation.
13105
- - If no_switch is FALSE or omitted, Excel switches to straight-line depreciation when depreciation is greater than the declining balance calculation.
13106
- * @returns
13107
- */
13108
- function VDB() {
13109
- throw new Error('VDB is not implemented')
13110
- }
13111
-
13112
12581
  /**
13113
12582
  * Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic.
13114
12583
  *
@@ -13224,66 +12693,6 @@ function XNPV(rate, values, dates) {
13224
12693
  return result
13225
12694
  }
13226
12695
 
13227
- // TODO
13228
- /**
13229
- * -- Not implemented --
13230
- *
13231
- * Returns the yield on a security that pays periodic interest.
13232
- *
13233
- * Category: Financial
13234
- *
13235
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
13236
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
13237
- * @param {*} rate The security's annual coupon rate.
13238
- * @param {*} pr The security's price per $100 face value.
13239
- * @param {*} redemption The security's redemption value per $100 face value.
13240
- * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
13241
- * @param {*} basis Optional. The type of day count basis to use.
13242
- * @returns
13243
- */
13244
- function YIELD() {
13245
- throw new Error('YIELD is not implemented')
13246
- }
13247
-
13248
- // TODO
13249
- /**
13250
- * -- Not implemented --
13251
- *
13252
- * Returns the annual yield for a discounted security; for example, a Treasury bill.
13253
- *
13254
- * Category: Financial
13255
- *
13256
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
13257
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
13258
- * @param {*} pr The security's price per $100 face value.
13259
- * @param {*} redemption The security's redemption value per $100 face value.
13260
- * @param {*} basis Optional. The type of day count basis to use.
13261
- * @returns
13262
- */
13263
- function YIELDDISC() {
13264
- throw new Error('YIELDDISC is not implemented')
13265
- }
13266
-
13267
- // TODO
13268
- /**
13269
- * -- Not implemented --
13270
- *
13271
- * Returns the annual yield of a security that pays interest at maturity.
13272
- *
13273
- * Category: Financial
13274
- *
13275
- * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
13276
- * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
13277
- * @param {*} issue The security's issue date, expressed as a serial date number.
13278
- * @param {*} rate The security's interest rate at date of issue.
13279
- * @param {*} pr The security's price per $100 face value.
13280
- * @param {*} basis Optional. The type of day count basis to use.
13281
- * @returns
13282
- */
13283
- function YIELDMAT() {
13284
- throw new Error('YIELDMAT is not implemented')
13285
- }
13286
-
13287
12696
  /**
13288
12697
  * Returns TRUE if all of its arguments are TRUE.
13289
12698
  *
@@ -13566,21 +12975,17 @@ async function GETTXLIST(address, page, offset) {
13566
12975
  }
13567
12976
  }
13568
12977
 
13569
- const utils = { errors, symbols };
12978
+ const utils = { errors, symbols, date };
13570
12979
 
13571
12980
  exports.ABS = ABS;
13572
12981
  exports.ACCRINT = ACCRINT;
13573
- exports.ACCRINTM = ACCRINTM;
13574
12982
  exports.ACOS = ACOS;
13575
12983
  exports.ACOSH = ACOSH;
13576
12984
  exports.ACOT = ACOT;
13577
12985
  exports.ACOTH = ACOTH;
13578
12986
  exports.AGGREGATE = AGGREGATE;
13579
- exports.AMORDEGRC = AMORDEGRC;
13580
- exports.AMORLINC = AMORLINC;
13581
12987
  exports.AND = AND;
13582
12988
  exports.ARABIC = ARABIC;
13583
- exports.ASC = ASC;
13584
12989
  exports.ASIN = ASIN;
13585
12990
  exports.ASINH = ASINH;
13586
12991
  exports.ATAN = ATAN;
@@ -13591,7 +12996,6 @@ exports.AVERAGE = AVERAGE;
13591
12996
  exports.AVERAGEA = AVERAGEA;
13592
12997
  exports.AVERAGEIF = AVERAGEIF;
13593
12998
  exports.AVERAGEIFS = AVERAGEIFS;
13594
- exports.BAHTTEXT = BAHTTEXT;
13595
12999
  exports.BASE = BASE;
13596
13000
  exports.BESSELI = BESSELI;
13597
13001
  exports.BESSELJ = BESSELJ;
@@ -13613,7 +13017,6 @@ exports.BITXOR = BITXOR;
13613
13017
  exports.CEILING = CEILING;
13614
13018
  exports.CEILINGMATH = CEILINGMATH;
13615
13019
  exports.CEILINGPRECISE = CEILINGPRECISE;
13616
- exports.CELL = CELL;
13617
13020
  exports.CHAR = CHAR;
13618
13021
  exports.CHIDIST = CHIDIST;
13619
13022
  exports.CHIDISTRT = CHIDISTRT;
@@ -13643,12 +13046,7 @@ exports.COUNTA = COUNTA;
13643
13046
  exports.COUNTBLANK = COUNTBLANK;
13644
13047
  exports.COUNTIF = COUNTIF;
13645
13048
  exports.COUNTIFS = COUNTIFS;
13646
- exports.COUPDAYBS = COUPDAYBS;
13647
13049
  exports.COUPDAYS = COUPDAYS;
13648
- exports.COUPDAYSNC = COUPDAYSNC;
13649
- exports.COUPNCD = COUPNCD;
13650
- exports.COUPNUM = COUPNUM;
13651
- exports.COUPPCD = COUPPCD;
13652
13050
  exports.COVAR = COVAR;
13653
13051
  exports.COVARIANCE = COVARIANCE;
13654
13052
  exports.COVARIANCEP = COVARIANCEP;
@@ -13666,7 +13064,6 @@ exports.DAY = DAY;
13666
13064
  exports.DAYS = DAYS;
13667
13065
  exports.DAYS360 = DAYS360;
13668
13066
  exports.DB = DB;
13669
- exports.DBCS = DBCS;
13670
13067
  exports.DCOUNT = DCOUNT;
13671
13068
  exports.DCOUNTA = DCOUNTA;
13672
13069
  exports.DDB = DDB;
@@ -13688,7 +13085,6 @@ exports.DPRODUCT = DPRODUCT;
13688
13085
  exports.DSTDEV = DSTDEV;
13689
13086
  exports.DSTDEVP = DSTDEVP;
13690
13087
  exports.DSUM = DSUM;
13691
- exports.DURATION = DURATION;
13692
13088
  exports.DVAR = DVAR;
13693
13089
  exports.DVARP = DVARP;
13694
13090
  exports.EDATE = EDATE;
@@ -13773,17 +13169,14 @@ exports.IMSUB = IMSUB;
13773
13169
  exports.IMSUM = IMSUM;
13774
13170
  exports.IMTAN = IMTAN;
13775
13171
  exports.INDEX = INDEX;
13776
- exports.INFO = INFO;
13777
13172
  exports.INT = INT;
13778
13173
  exports.INTERCEPT = INTERCEPT;
13779
- exports.INTRATE = INTRATE;
13780
13174
  exports.IPMT = IPMT;
13781
13175
  exports.IRR = IRR;
13782
13176
  exports.ISBLANK = ISBLANK;
13783
13177
  exports.ISERR = ISERR;
13784
13178
  exports.ISERROR = ISERROR;
13785
13179
  exports.ISEVEN = ISEVEN;
13786
- exports.ISFORMULA = ISFORMULA;
13787
13180
  exports.ISLOGICAL = ISLOGICAL;
13788
13181
  exports.ISNA = ISNA;
13789
13182
  exports.ISNONTEXT = ISNONTEXT;
@@ -13792,7 +13185,6 @@ exports.ISO = ISO;
13792
13185
  exports.ISODD = ISODD;
13793
13186
  exports.ISOWEEKNUM = ISOWEEKNUM;
13794
13187
  exports.ISPMT = ISPMT;
13795
- exports.ISREF = ISREF;
13796
13188
  exports.ISTEXT = ISTEXT;
13797
13189
  exports.KURT = KURT;
13798
13190
  exports.LARGE = LARGE;
@@ -13814,7 +13206,6 @@ exports.MATCH = MATCH;
13814
13206
  exports.MAX = MAX;
13815
13207
  exports.MAXA = MAXA;
13816
13208
  exports.MAXIFS = MAXIFS;
13817
- exports.MDURATION = MDURATION;
13818
13209
  exports.MEDIAN = MEDIAN;
13819
13210
  exports.MID = MID;
13820
13211
  exports.MIN = MIN;
@@ -13852,10 +13243,6 @@ exports.OCT2BIN = OCT2BIN;
13852
13243
  exports.OCT2DEC = OCT2DEC;
13853
13244
  exports.OCT2HEX = OCT2HEX;
13854
13245
  exports.ODD = ODD;
13855
- exports.ODDFPRICE = ODDFPRICE;
13856
- exports.ODDFYIELD = ODDFYIELD;
13857
- exports.ODDLPRICE = ODDLPRICE;
13858
- exports.ODDLYIELD = ODDLYIELD;
13859
13246
  exports.OR = OR;
13860
13247
  exports.PDURATION = PDURATION;
13861
13248
  exports.PEARSON = PEARSON;
@@ -13874,12 +13261,9 @@ exports.POISSON = POISSON;
13874
13261
  exports.POISSONDIST = POISSONDIST;
13875
13262
  exports.POWER = POWER;
13876
13263
  exports.PPMT = PPMT;
13877
- exports.PRICE = PRICE;
13878
13264
  exports.PRICEDISC = PRICEDISC;
13879
- exports.PRICEMAT = PRICEMAT;
13880
13265
  exports.PROB = PROB;
13881
13266
  exports.PRODUCT = PRODUCT;
13882
- exports.PRONETIC = PRONETIC;
13883
13267
  exports.PROPER = PROPER;
13884
13268
  exports.PV = PV;
13885
13269
  exports.QUARTILE = QUARTILE;
@@ -13893,7 +13277,6 @@ exports.RANK = RANK;
13893
13277
  exports.RANKAVG = RANKAVG;
13894
13278
  exports.RANKEQ = RANKEQ;
13895
13279
  exports.RATE = RATE;
13896
- exports.RECEIVED = RECEIVED;
13897
13280
  exports.REPLACE = REPLACE;
13898
13281
  exports.REPT = REPT;
13899
13282
  exports.RIGHT = RIGHT;
@@ -13910,8 +13293,6 @@ exports.SEC = SEC;
13910
13293
  exports.SECH = SECH;
13911
13294
  exports.SECOND = SECOND;
13912
13295
  exports.SERIESSUM = SERIESSUM;
13913
- exports.SHEET = SHEET;
13914
- exports.SHEETS = SHEETS;
13915
13296
  exports.SIGN = SIGN;
13916
13297
  exports.SIN = SIN;
13917
13298
  exports.SINH = SINH;
@@ -13974,7 +13355,6 @@ exports.VARA = VARA;
13974
13355
  exports.VARP = VARP;
13975
13356
  exports.VARPA = VARPA;
13976
13357
  exports.VARS = VARS;
13977
- exports.VDB = VDB;
13978
13358
  exports.VLOOKUP = VLOOKUP;
13979
13359
  exports.WEEKDAY = WEEKDAY;
13980
13360
  exports.WEEKNUM = WEEKNUM;
@@ -13987,9 +13367,6 @@ exports.XNPV = XNPV;
13987
13367
  exports.XOR = XOR;
13988
13368
  exports.YEAR = YEAR;
13989
13369
  exports.YEARFRAC = YEARFRAC;
13990
- exports.YIELD = YIELD;
13991
- exports.YIELDDISC = YIELDDISC;
13992
- exports.YIELDMAT = YIELDMAT;
13993
13370
  exports.Z = Z;
13994
13371
  exports.ZTEST = ZTEST;
13995
13372
  exports.utils = utils;