DateTimeExcel - Change Names of funcWhatever to evaluate (#2015)
* DateTimeExcel - Change Names of funcWhatever to evaluate Per discussions while MathTrig was being broken up, this would help standardize the code. This PR applies that standardization to the DateTimeExcel family of functions. The deprecation messages in DateTime.php are changed to match the style used in PR #2005. All Phpstan grandfathered errors (about 25) in DateTimeExcel are fixed and removed from baseline. A small number (about 5) of phpstan annotations in the source members in that directory are also fixed and eliminated.
This commit is contained in:
parent
a01a401228
commit
1e8ff9f852
|
|
@ -340,141 +340,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php
|
path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTime\\:\\:NETWORKDAYS\\(\\) has parameter \\$dateArgs with no typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTime.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTime\\:\\:WORKDAY\\(\\) has parameter \\$dateArgs with no typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTime.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$haystack of function strpos expects string, float\\|int\\|string given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$PHPDateArray of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\DateValue\\:\\:finalResults\\(\\) expects array\\|false, array\\|bool given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$testVal1 of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:adjustYear\\(\\) expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#2 \\$testVal2 of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:adjustYear\\(\\) expects string, string\\|false given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$value of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:testStringAsNumeric\\(\\) expects string, float\\|int\\|string given\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Datefunc.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Day\\:\\:weirdCondition\\(\\) has parameter \\$dateValue with no typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Day.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:adjustDateByMonths\\(\\) has no return typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:adjustDateByMonths\\(\\) has parameter \\$adjustmentMonths with no typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:adjustDateByMonths\\(\\) has parameter \\$dateValue with no typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$excelTimestamp of static method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Date\\:\\:excelToTimestamp\\(\\) expects float\\|int, bool\\|float given\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Helpers\\:\\:validateNumericNull\\(\\) should return float\\|int but returns float\\|int\\|string\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\IsoWeekNum\\:\\:apparentBug\\(\\) has parameter \\$dateValue with no typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/IsoWeekNum.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\NetworkDays\\:\\:funcNetworkDays\\(\\) has parameter \\$dateArgs with no typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/NetworkDays.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\NetworkDays\\:\\:applySign\\(\\) has no return typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/NetworkDays.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\Time\\:\\:toIntWithNullBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/Time.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Cannot access offset 0 on array\\<int, string\\>\\|false\\.$#"
|
|
||||||
count: 3
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, array\\<int, string\\>\\|false given\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\WeekDay\\:\\:validateStyle\\(\\) has parameter \\$style with no typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/WeekDay.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\DateTimeExcel\\\\WorkDay\\:\\:funcWorkDay\\(\\) has parameter \\$dateArgs with no typehint specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Binary operation \"\\-\" between 7 and int\\|string results in an error\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Binary operation \"\\-\" between 7 and int\\<5, max\\>\\|string results in an error\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Binary operation \"\\-\" between 4 and int\\<5, max\\>\\|string results in an error\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/WorkDay.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Binary operation \"\\-\" between int\\|string and int\\|string results in an error\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Binary operation \"\\*\" between 100 and int\\|string results in an error\\.$#"
|
|
||||||
count: 2
|
|
||||||
path: src/PhpSpreadsheet/Calculation/DateTimeExcel/YearFrac.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engine\\\\Logger\\:\\:writeDebugLog\\(\\) has parameter \\$args with no typehint specified\\.$#"
|
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Engine\\\\Logger\\:\\:writeDebugLog\\(\\) has parameter \\$args with no typehint specified\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
|
||||||
|
|
@ -755,17 +755,17 @@ class Calculation
|
||||||
],
|
],
|
||||||
'DATE' => [
|
'DATE' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Datefunc::class, 'funcDate'],
|
'functionCall' => [DateTimeExcel\Datefunc::class, 'evaluate'],
|
||||||
'argumentCount' => '3',
|
'argumentCount' => '3',
|
||||||
],
|
],
|
||||||
'DATEDIF' => [
|
'DATEDIF' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\DateDif::class, 'funcDateDif'],
|
'functionCall' => [DateTimeExcel\DateDif::class, 'evaluate'],
|
||||||
'argumentCount' => '2,3',
|
'argumentCount' => '2,3',
|
||||||
],
|
],
|
||||||
'DATEVALUE' => [
|
'DATEVALUE' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\DateValue::class, 'funcDateValue'],
|
'functionCall' => [DateTimeExcel\DateValue::class, 'evaluate'],
|
||||||
'argumentCount' => '1',
|
'argumentCount' => '1',
|
||||||
],
|
],
|
||||||
'DAVERAGE' => [
|
'DAVERAGE' => [
|
||||||
|
|
@ -775,17 +775,17 @@ class Calculation
|
||||||
],
|
],
|
||||||
'DAY' => [
|
'DAY' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Day::class, 'funcDay'],
|
'functionCall' => [DateTimeExcel\Day::class, 'evaluate'],
|
||||||
'argumentCount' => '1',
|
'argumentCount' => '1',
|
||||||
],
|
],
|
||||||
'DAYS' => [
|
'DAYS' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Days::class, 'funcDays'],
|
'functionCall' => [DateTimeExcel\Days::class, 'evaluate'],
|
||||||
'argumentCount' => '2',
|
'argumentCount' => '2',
|
||||||
],
|
],
|
||||||
'DAYS360' => [
|
'DAYS360' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Days360::class, 'funcDays360'],
|
'functionCall' => [DateTimeExcel\Days360::class, 'evaluate'],
|
||||||
'argumentCount' => '2,3',
|
'argumentCount' => '2,3',
|
||||||
],
|
],
|
||||||
'DB' => [
|
'DB' => [
|
||||||
|
|
@ -920,7 +920,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'EDATE' => [
|
'EDATE' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\EDate::class, 'funcEDate'],
|
'functionCall' => [DateTimeExcel\EDate::class, 'evaluate'],
|
||||||
'argumentCount' => '2',
|
'argumentCount' => '2',
|
||||||
],
|
],
|
||||||
'EFFECT' => [
|
'EFFECT' => [
|
||||||
|
|
@ -935,7 +935,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'EOMONTH' => [
|
'EOMONTH' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\EoMonth::class, 'funcEoMonth'],
|
'functionCall' => [DateTimeExcel\EoMonth::class, 'evaluate'],
|
||||||
'argumentCount' => '2',
|
'argumentCount' => '2',
|
||||||
],
|
],
|
||||||
'ERF' => [
|
'ERF' => [
|
||||||
|
|
@ -1237,7 +1237,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'HOUR' => [
|
'HOUR' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Hour::class, 'funcHour'],
|
'functionCall' => [DateTimeExcel\Hour::class, 'evaluate'],
|
||||||
'argumentCount' => '1',
|
'argumentCount' => '1',
|
||||||
],
|
],
|
||||||
'HYPERLINK' => [
|
'HYPERLINK' => [
|
||||||
|
|
@ -1501,7 +1501,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'ISOWEEKNUM' => [
|
'ISOWEEKNUM' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\IsoWeekNum::class, 'funcIsoWeekNum'],
|
'functionCall' => [DateTimeExcel\IsoWeekNum::class, 'evaluate'],
|
||||||
'argumentCount' => '1',
|
'argumentCount' => '1',
|
||||||
],
|
],
|
||||||
'ISPMT' => [
|
'ISPMT' => [
|
||||||
|
|
@ -1681,7 +1681,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'MINUTE' => [
|
'MINUTE' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Minute::class, 'funcMinute'],
|
'functionCall' => [DateTimeExcel\Minute::class, 'evaluate'],
|
||||||
'argumentCount' => '1',
|
'argumentCount' => '1',
|
||||||
],
|
],
|
||||||
'MINVERSE' => [
|
'MINVERSE' => [
|
||||||
|
|
@ -1721,7 +1721,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'MONTH' => [
|
'MONTH' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Month::class, 'funcMonth'],
|
'functionCall' => [DateTimeExcel\Month::class, 'evaluate'],
|
||||||
'argumentCount' => '1',
|
'argumentCount' => '1',
|
||||||
],
|
],
|
||||||
'MROUND' => [
|
'MROUND' => [
|
||||||
|
|
@ -1761,7 +1761,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'NETWORKDAYS' => [
|
'NETWORKDAYS' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\NetworkDays::class, 'funcNetworkDays'],
|
'functionCall' => [DateTimeExcel\NetworkDays::class, 'evaluate'],
|
||||||
'argumentCount' => '2-3',
|
'argumentCount' => '2-3',
|
||||||
],
|
],
|
||||||
'NETWORKDAYS.INTL' => [
|
'NETWORKDAYS.INTL' => [
|
||||||
|
|
@ -1821,7 +1821,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'NOW' => [
|
'NOW' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Now::class, 'funcNow'],
|
'functionCall' => [DateTimeExcel\Now::class, 'evaluate'],
|
||||||
'argumentCount' => '0',
|
'argumentCount' => '0',
|
||||||
],
|
],
|
||||||
'NPER' => [
|
'NPER' => [
|
||||||
|
|
@ -2175,7 +2175,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'SECOND' => [
|
'SECOND' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Second::class, 'funcSecond'],
|
'functionCall' => [DateTimeExcel\Second::class, 'evaluate'],
|
||||||
'argumentCount' => '1',
|
'argumentCount' => '1',
|
||||||
],
|
],
|
||||||
'SEQUENCE' => [
|
'SEQUENCE' => [
|
||||||
|
|
@ -2421,12 +2421,12 @@ class Calculation
|
||||||
],
|
],
|
||||||
'TIME' => [
|
'TIME' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Time::class, 'funcTime'],
|
'functionCall' => [DateTimeExcel\Time::class, 'evaluate'],
|
||||||
'argumentCount' => '3',
|
'argumentCount' => '3',
|
||||||
],
|
],
|
||||||
'TIMEVALUE' => [
|
'TIMEVALUE' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\TimeValue::class, 'funcTimeValue'],
|
'functionCall' => [DateTimeExcel\TimeValue::class, 'evaluate'],
|
||||||
'argumentCount' => '1',
|
'argumentCount' => '1',
|
||||||
],
|
],
|
||||||
'TINV' => [
|
'TINV' => [
|
||||||
|
|
@ -2446,7 +2446,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'TODAY' => [
|
'TODAY' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Today::class, 'funcToday'],
|
'functionCall' => [DateTimeExcel\Today::class, 'evaluate'],
|
||||||
'argumentCount' => '0',
|
'argumentCount' => '0',
|
||||||
],
|
],
|
||||||
'TRANSPOSE' => [
|
'TRANSPOSE' => [
|
||||||
|
|
@ -2571,12 +2571,12 @@ class Calculation
|
||||||
],
|
],
|
||||||
'WEEKDAY' => [
|
'WEEKDAY' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\WeekDay::class, 'funcWeekDay'],
|
'functionCall' => [DateTimeExcel\WeekDay::class, 'evaluate'],
|
||||||
'argumentCount' => '1,2',
|
'argumentCount' => '1,2',
|
||||||
],
|
],
|
||||||
'WEEKNUM' => [
|
'WEEKNUM' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\WeekNum::class, 'funcWeekNum'],
|
'functionCall' => [DateTimeExcel\WeekNum::class, 'evaluate'],
|
||||||
'argumentCount' => '1,2',
|
'argumentCount' => '1,2',
|
||||||
],
|
],
|
||||||
'WEIBULL' => [
|
'WEIBULL' => [
|
||||||
|
|
@ -2591,7 +2591,7 @@ class Calculation
|
||||||
],
|
],
|
||||||
'WORKDAY' => [
|
'WORKDAY' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\WorkDay::class, 'funcWorkDay'],
|
'functionCall' => [DateTimeExcel\WorkDay::class, 'evaluate'],
|
||||||
'argumentCount' => '2-3',
|
'argumentCount' => '2-3',
|
||||||
],
|
],
|
||||||
'WORKDAY.INTL' => [
|
'WORKDAY.INTL' => [
|
||||||
|
|
@ -2626,12 +2626,12 @@ class Calculation
|
||||||
],
|
],
|
||||||
'YEAR' => [
|
'YEAR' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\Year::class, 'funcYear'],
|
'functionCall' => [DateTimeExcel\Year::class, 'evaluate'],
|
||||||
'argumentCount' => '1',
|
'argumentCount' => '1',
|
||||||
],
|
],
|
||||||
'YEARFRAC' => [
|
'YEARFRAC' => [
|
||||||
'category' => Category::CATEGORY_DATE_AND_TIME,
|
'category' => Category::CATEGORY_DATE_AND_TIME,
|
||||||
'functionCall' => [DateTimeExcel\YearFrac::class, 'funcYearFrac'],
|
'functionCall' => [DateTimeExcel\YearFrac::class, 'evaluate'],
|
||||||
'argumentCount' => '2,3',
|
'argumentCount' => '2,3',
|
||||||
],
|
],
|
||||||
'YIELD' => [
|
'YIELD' => [
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,10 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* Identify if a year is a leap year or not.
|
* Identify if a year is a leap year or not.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the method isLeapYear in the DateTimeExcel\Helpers class instead
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Helpers::isLeapYear()
|
||||||
|
* Use the isLeapYear method in the DateTimeExcel\Helpers class instead
|
||||||
*
|
*
|
||||||
* @param int|string $year The year to test
|
* @param int|string $year The year to test
|
||||||
*
|
*
|
||||||
|
|
@ -23,7 +26,10 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* getDateValue.
|
* getDateValue.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the method getDateValue in the DateTimeExcel\Helpers class instead
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Helpers::getDateValue()
|
||||||
|
* Use the getDateValue method in the DateTimeExcel\Helpers class instead
|
||||||
*
|
*
|
||||||
* @param mixed $dateValue
|
* @param mixed $dateValue
|
||||||
*
|
*
|
||||||
|
|
@ -49,17 +55,20 @@ class DateTime
|
||||||
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
|
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
|
||||||
* and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
* and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcNow method in the DateTimeExcel\Now class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* NOW()
|
* NOW()
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Now::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Now class instead
|
||||||
|
*
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function DATETIMENOW()
|
public static function DATETIMENOW()
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Now::funcNow();
|
return DateTimeExcel\Now::evaluate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -73,17 +82,20 @@ class DateTime
|
||||||
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
|
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
|
||||||
* and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
* and time format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcToday method in the DateTimeExcel\Today class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* TODAY()
|
* TODAY()
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Today::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Today class instead
|
||||||
|
*
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function DATENOW()
|
public static function DATENOW()
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Today::funcToday();
|
return DateTimeExcel\Today::evaluate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -94,11 +106,15 @@ class DateTime
|
||||||
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
|
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
|
||||||
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcDate method in the DateTimeExcel\Date class instead
|
|
||||||
*
|
*
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* DATE(year,month,day)
|
* DATE(year,month,day)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Datefunc::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Datefunc class instead
|
||||||
|
*
|
||||||
* PhpSpreadsheet is a lot more forgiving than MS Excel when passing non numeric values to this function.
|
* PhpSpreadsheet is a lot more forgiving than MS Excel when passing non numeric values to this function.
|
||||||
* A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted,
|
* A Month name or abbreviation (English only at this point) such as 'January' or 'Jan' will still be accepted,
|
||||||
* as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language.
|
* as will a day value with a suffix (e.g. '21st' rather than simply 21); again only English language.
|
||||||
|
|
@ -139,7 +155,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function DATE($year = 0, $month = 1, $day = 1)
|
public static function DATE($year = 0, $month = 1, $day = 1)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Datefunc::funcDate($year, $month, $day);
|
return DateTimeExcel\Datefunc::evaluate($year, $month, $day);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -150,11 +166,14 @@ class DateTime
|
||||||
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time
|
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time
|
||||||
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcTime method in the DateTimeExcel\Time class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* TIME(hour,minute,second)
|
* TIME(hour,minute,second)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Time::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Time class instead
|
||||||
|
*
|
||||||
* @param int $hour A number from 0 (zero) to 32767 representing the hour.
|
* @param int $hour A number from 0 (zero) to 32767 representing the hour.
|
||||||
* Any value greater than 23 will be divided by 24 and the remainder
|
* Any value greater than 23 will be divided by 24 and the remainder
|
||||||
* will be treated as the hour value. For example, TIME(27,0,0) =
|
* will be treated as the hour value. For example, TIME(27,0,0) =
|
||||||
|
|
@ -172,7 +191,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function TIME($hour = 0, $minute = 0, $second = 0)
|
public static function TIME($hour = 0, $minute = 0, $second = 0)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Time::funcTime($hour, $minute, $second);
|
return DateTimeExcel\Time::evaluate($hour, $minute, $second);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -185,11 +204,14 @@ class DateTime
|
||||||
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
|
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the date
|
||||||
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcDateValue method in the DateTimeExcel\DateValue class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* DATEVALUE(dateValue)
|
* DATEVALUE(dateValue)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\DateValue::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\DateValue class instead
|
||||||
|
*
|
||||||
* @param string $dateValue Text that represents a date in a Microsoft Excel date format.
|
* @param string $dateValue Text that represents a date in a Microsoft Excel date format.
|
||||||
* For example, "1/30/2008" or "30-Jan-2008" are text strings within
|
* For example, "1/30/2008" or "30-Jan-2008" are text strings within
|
||||||
* quotation marks that represent dates. Using the default date
|
* quotation marks that represent dates. Using the default date
|
||||||
|
|
@ -204,7 +226,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function DATEVALUE($dateValue)
|
public static function DATEVALUE($dateValue)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\DateValue::funcDateValue($dateValue);
|
return DateTimeExcel\DateValue::evaluate($dateValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -217,11 +239,14 @@ class DateTime
|
||||||
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time
|
* NOTE: When used in a Cell Formula, MS Excel changes the cell format so that it matches the time
|
||||||
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
* format of your regional settings. PhpSpreadsheet does not change cell formatting in this way.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcTimeValue method in the DateTimeExcel\TimeValue class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* TIMEVALUE(timeValue)
|
* TIMEVALUE(timeValue)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\TimeValue::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\TimeValue class instead
|
||||||
|
*
|
||||||
* @param string $timeValue A text string that represents a time in any one of the Microsoft
|
* @param string $timeValue A text string that represents a time in any one of the Microsoft
|
||||||
* Excel time formats; for example, "6:45 PM" and "18:45" text strings
|
* Excel time formats; for example, "6:45 PM" and "18:45" text strings
|
||||||
* within quotation marks that represent time.
|
* within quotation marks that represent time.
|
||||||
|
|
@ -232,13 +257,19 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function TIMEVALUE($timeValue)
|
public static function TIMEVALUE($timeValue)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\TimeValue::funcTimeValue($timeValue);
|
return DateTimeExcel\TimeValue::evaluate($timeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DATEDIF.
|
* DATEDIF.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcDateDif method in the DateTimeExcel\DateDif class instead
|
* Excel Function:
|
||||||
|
* DATEDIF(startdate, enddate, unit)
|
||||||
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\DateDif::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\DateDif class instead
|
||||||
*
|
*
|
||||||
* @param mixed $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object
|
* @param mixed $startDate Excel date serial value, PHP date/time stamp, PHP DateTime object
|
||||||
* or a standard date string
|
* or a standard date string
|
||||||
|
|
@ -250,7 +281,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D')
|
public static function DATEDIF($startDate = 0, $endDate = 0, $unit = 'D')
|
||||||
{
|
{
|
||||||
return DateTimeExcel\DateDif::funcDateDif($startDate, $endDate, $unit);
|
return DateTimeExcel\DateDif::evaluate($startDate, $endDate, $unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -258,11 +289,14 @@ class DateTime
|
||||||
*
|
*
|
||||||
* Returns the number of days between two dates
|
* Returns the number of days between two dates
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcDays method in the DateTimeExcel\Days class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* DAYS(endDate, startDate)
|
* DAYS(endDate, startDate)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Days::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Days class instead
|
||||||
|
*
|
||||||
* @param DateTimeInterface|float|int|string $endDate Excel date serial value (float),
|
* @param DateTimeInterface|float|int|string $endDate Excel date serial value (float),
|
||||||
* PHP date timestamp (integer), PHP DateTime object, or a standard date string
|
* PHP date timestamp (integer), PHP DateTime object, or a standard date string
|
||||||
* @param DateTimeInterface|float|int|string $startDate Excel date serial value (float),
|
* @param DateTimeInterface|float|int|string $startDate Excel date serial value (float),
|
||||||
|
|
@ -272,7 +306,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function DAYS($endDate = 0, $startDate = 0)
|
public static function DAYS($endDate = 0, $startDate = 0)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Days::funcDays($endDate, $startDate);
|
return DateTimeExcel\Days::evaluate($endDate, $startDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -282,11 +316,14 @@ class DateTime
|
||||||
* which is used in some accounting calculations. Use this function to help compute payments if
|
* which is used in some accounting calculations. Use this function to help compute payments if
|
||||||
* your accounting system is based on twelve 30-day months.
|
* your accounting system is based on twelve 30-day months.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcDays360 method in the DateTimeExcel\Days360 class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* DAYS360(startDate,endDate[,method])
|
* DAYS360(startDate,endDate[,method])
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Days360::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Days360 class instead
|
||||||
|
*
|
||||||
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
|
||||||
|
|
@ -307,7 +344,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function DAYS360($startDate = 0, $endDate = 0, $method = false)
|
public static function DAYS360($startDate = 0, $endDate = 0, $method = false)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Days360::funcDays360($startDate, $endDate, $method);
|
return DateTimeExcel\Days360::evaluate($startDate, $endDate, $method);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -318,10 +355,14 @@ class DateTime
|
||||||
* Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or
|
* Use the YEARFRAC worksheet function to identify the proportion of a whole year's benefits or
|
||||||
* obligations to assign to a specific term.
|
* obligations to assign to a specific term.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcYearFrac method in the DateTimeExcel\YearFrac class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* YEARFRAC(startDate,endDate[,method])
|
* YEARFRAC(startDate,endDate[,method])
|
||||||
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\YearFrac::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\YearFrac class instead
|
||||||
|
*
|
||||||
* See https://lists.oasis-open.org/archives/office-formula/200806/msg00039.html
|
* See https://lists.oasis-open.org/archives/office-formula/200806/msg00039.html
|
||||||
* for description of algorithm used in Excel
|
* for description of algorithm used in Excel
|
||||||
*
|
*
|
||||||
|
|
@ -340,7 +381,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0)
|
public static function YEARFRAC($startDate = 0, $endDate = 0, $method = 0)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\YearFrac::funcYearFrac($startDate, $endDate, $method);
|
return DateTimeExcel\YearFrac::evaluate($startDate, $endDate, $method);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -351,21 +392,25 @@ class DateTime
|
||||||
* Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days
|
* Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days
|
||||||
* worked during a specific term.
|
* worked during a specific term.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcNetworkDays method in the DateTimeExcel\NetworkDays class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* NETWORKDAYS(startDate,endDate[,holidays[,holiday[,...]]])
|
* NETWORKDAYS(startDate,endDate[,holidays[,holiday[,...]]])
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\NetworkDays::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\NetworkDays class instead
|
||||||
|
*
|
||||||
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
|
* @param mixed $dateArgs
|
||||||
*
|
*
|
||||||
* @return int|string Interval between the dates
|
* @return int|string Interval between the dates
|
||||||
*/
|
*/
|
||||||
public static function NETWORKDAYS($startDate, $endDate, ...$dateArgs)
|
public static function NETWORKDAYS($startDate, $endDate, ...$dateArgs)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\NetworkDays::funcNetworkDays($startDate, $endDate, ...$dateArgs);
|
return DateTimeExcel\NetworkDays::evaluate($startDate, $endDate, ...$dateArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -376,23 +421,27 @@ class DateTime
|
||||||
* Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected
|
* Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected
|
||||||
* delivery times, or the number of days of work performed.
|
* delivery times, or the number of days of work performed.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcWorkDay method in the DateTimeExcel\WorkDay class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* WORKDAY(startDate,endDays[,holidays[,holiday[,...]]])
|
* WORKDAY(startDate,endDays[,holidays[,holiday[,...]]])
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\WorkDay::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\WorkDay class instead
|
||||||
|
*
|
||||||
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $startDate Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
* @param int $endDays The number of nonweekend and nonholiday days before or after
|
* @param int $endDays The number of nonweekend and nonholiday days before or after
|
||||||
* startDate. A positive value for days yields a future date; a
|
* startDate. A positive value for days yields a future date; a
|
||||||
* negative value yields a past date.
|
* negative value yields a past date.
|
||||||
|
* @param mixed $dateArgs
|
||||||
*
|
*
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function WORKDAY($startDate, $endDays, ...$dateArgs)
|
public static function WORKDAY($startDate, $endDays, ...$dateArgs)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\WorkDay::funcWorkDay($startDate, $endDays, ...$dateArgs);
|
return DateTimeExcel\WorkDay::evaluate($startDate, $endDays, ...$dateArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -401,11 +450,14 @@ class DateTime
|
||||||
* Returns the day of the month, for a specified date. The day is given as an integer
|
* Returns the day of the month, for a specified date. The day is given as an integer
|
||||||
* ranging from 1 to 31.
|
* ranging from 1 to 31.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcDay method in the DateTimeExcel\Day class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* DAY(dateValue)
|
* DAY(dateValue)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Day::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Day class instead
|
||||||
|
*
|
||||||
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
*
|
*
|
||||||
|
|
@ -413,7 +465,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function DAYOFMONTH($dateValue = 1)
|
public static function DAYOFMONTH($dateValue = 1)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Day::funcDay($dateValue);
|
return DateTimeExcel\Day::evaluate($dateValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -422,11 +474,14 @@ class DateTime
|
||||||
* Returns the day of the week for a specified date. The day is given as an integer
|
* Returns the day of the week for a specified date. The day is given as an integer
|
||||||
* ranging from 0 to 7 (dependent on the requested style).
|
* ranging from 0 to 7 (dependent on the requested style).
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcWeekDay method in the DateTimeExcel\WeekDay class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* WEEKDAY(dateValue[,style])
|
* WEEKDAY(dateValue[,style])
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\WeekDay::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\WeekDay class instead
|
||||||
|
*
|
||||||
* @param float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
* @param int $style A number that determines the type of return value
|
* @param int $style A number that determines the type of return value
|
||||||
|
|
@ -438,13 +493,13 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function WEEKDAY($dateValue = 1, $style = 1)
|
public static function WEEKDAY($dateValue = 1, $style = 1)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\WeekDay::funcWeekDay($dateValue, $style);
|
return DateTimeExcel\WeekDay::evaluate($dateValue, $style);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* STARTWEEK_SUNDAY.
|
* STARTWEEK_SUNDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\STARTWEEK_SUNDAY instead
|
* @see Use DateTimeExcel\Constants\STARTWEEK_SUNDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -453,7 +508,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* STARTWEEK_MONDAY.
|
* STARTWEEK_MONDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY instead
|
* @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -462,7 +517,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* STARTWEEK_MONDAY_ALT.
|
* STARTWEEK_MONDAY_ALT.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY_ALT instead
|
* @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY_ALT instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -471,7 +526,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* STARTWEEK_TUESDAY.
|
* STARTWEEK_TUESDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\STARTWEEK_TUESDAY instead
|
* @see Use DateTimeExcel\Constants\STARTWEEK_TUESDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -480,7 +535,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* STARTWEEK_WEDNESDAY.
|
* STARTWEEK_WEDNESDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\STARTWEEK_WEDNESDAY instead
|
* @see Use DateTimeExcel\Constants\STARTWEEK_WEDNESDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -489,7 +544,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* STARTWEEK_THURSDAY.
|
* STARTWEEK_THURSDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\STARTWEEK_THURSDAY instead
|
* @see Use DateTimeExcel\Constants\STARTWEEK_THURSDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -498,7 +553,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* STARTWEEK_FRIDAY.
|
* STARTWEEK_FRIDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\STARTWEEK_FRIDAY instead
|
* @see Use DateTimeExcel\Constants\STARTWEEK_FRIDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -507,7 +562,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* STARTWEEK_SATURDAY.
|
* STARTWEEK_SATURDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\STARTWEEK_SATURDAY instead
|
* @see Use DateTimeExcel\Constants\STARTWEEK_SATURDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -516,7 +571,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* STARTWEEK_SUNDAY_ALT.
|
* STARTWEEK_SUNDAY_ALT.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\STARTWEEK_SUNDAY_ALT instead
|
* @see Use DateTimeExcel\Constants\STARTWEEK_SUNDAY_ALT instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -525,7 +580,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* DOW_SUNDAY.
|
* DOW_SUNDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\DOW_SUNDAY instead
|
* @see Use DateTimeExcel\Constants\DOW_SUNDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -534,7 +589,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* DOW_MONDAY.
|
* DOW_MONDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\DOW_MONDAY instead
|
* @see Use DateTimeExcel\Constants\DOW_MONDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -543,7 +598,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* DOW_TUESDAY.
|
* DOW_TUESDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\DOW_TUESDAY instead
|
* @see Use DateTimeExcel\Constants\DOW_TUESDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -552,7 +607,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* DOW_WEDNESDAY.
|
* DOW_WEDNESDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\DOW_WEDNESDAY instead
|
* @see Use DateTimeExcel\Constants\DOW_WEDNESDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -561,7 +616,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* DOW_THURSDAY.
|
* DOW_THURSDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\DOW_THURSDAY instead
|
* @see Use DateTimeExcel\Constants\DOW_THURSDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -570,7 +625,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* DOW_FRIDAY.
|
* DOW_FRIDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\DOW_FRIDAY instead
|
* @see Use DateTimeExcel\Constants\DOW_FRIDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -579,7 +634,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* DOW_SATURDAY.
|
* DOW_SATURDAY.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\DOW_SATURDAY instead
|
* @see Use DateTimeExcel\Constants\DOW_SATURDAY instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -588,7 +643,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* STARTWEEK_MONDAY_ISO.
|
* STARTWEEK_MONDAY_ISO.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY_ISO instead
|
* @see Use DateTimeExcel\Constants\STARTWEEK_MONDAY_ISO instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -597,7 +652,7 @@ class DateTime
|
||||||
/**
|
/**
|
||||||
* METHODARR.
|
* METHODARR.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0
|
* @Deprecated 1.18.0
|
||||||
*
|
*
|
||||||
* @see Use DateTimeExcel\Constants\METHODARR instead
|
* @see Use DateTimeExcel\Constants\METHODARR instead
|
||||||
*/
|
*/
|
||||||
|
|
@ -624,11 +679,14 @@ class DateTime
|
||||||
* three days or less in the first week of January, the WEEKNUM function returns week numbers
|
* three days or less in the first week of January, the WEEKNUM function returns week numbers
|
||||||
* that are incorrect according to the European standard.
|
* that are incorrect according to the European standard.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcWeekNum method in the DateTimeExcel\WeekNum class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* WEEKNUM(dateValue[,style])
|
* WEEKNUM(dateValue[,style])
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\WeekNum::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\WeekNum class instead
|
||||||
|
*
|
||||||
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
* @param int $method Week begins on Sunday or Monday
|
* @param int $method Week begins on Sunday or Monday
|
||||||
|
|
@ -647,7 +705,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function WEEKNUM($dateValue = 1, $method = self::STARTWEEK_SUNDAY)
|
public static function WEEKNUM($dateValue = 1, $method = self::STARTWEEK_SUNDAY)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\WeekNum::funcWeekNum($dateValue, $method);
|
return DateTimeExcel\WeekNum::evaluate($dateValue, $method);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -655,11 +713,14 @@ class DateTime
|
||||||
*
|
*
|
||||||
* Returns the ISO 8601 week number of the year for a specified date.
|
* Returns the ISO 8601 week number of the year for a specified date.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcIsoWeeknum method in the DateTimeExcel\IsoWeekNum class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* ISOWEEKNUM(dateValue)
|
* ISOWEEKNUM(dateValue)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\IsoWeekNum::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\IsoWeekNum class instead
|
||||||
|
*
|
||||||
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
*
|
*
|
||||||
|
|
@ -667,7 +728,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function ISOWEEKNUM($dateValue = 1)
|
public static function ISOWEEKNUM($dateValue = 1)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\IsoWeekNum::funcIsoWeekNum($dateValue);
|
return DateTimeExcel\IsoWeekNum::evaluate($dateValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -676,11 +737,14 @@ class DateTime
|
||||||
* Returns the month of a date represented by a serial number.
|
* Returns the month of a date represented by a serial number.
|
||||||
* The month is given as an integer, ranging from 1 (January) to 12 (December).
|
* The month is given as an integer, ranging from 1 (January) to 12 (December).
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcMonth method in the DateTimeExcel\Month class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* MONTH(dateValue)
|
* MONTH(dateValue)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Month::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Month class instead
|
||||||
|
*
|
||||||
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
*
|
*
|
||||||
|
|
@ -688,7 +752,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function MONTHOFYEAR($dateValue = 1)
|
public static function MONTHOFYEAR($dateValue = 1)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Month::funcMonth($dateValue);
|
return DateTimeExcel\Month::evaluate($dateValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -697,11 +761,14 @@ class DateTime
|
||||||
* Returns the year corresponding to a date.
|
* Returns the year corresponding to a date.
|
||||||
* The year is returned as an integer in the range 1900-9999.
|
* The year is returned as an integer in the range 1900-9999.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcYear method in the DateTimeExcel\Year class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* YEAR(dateValue)
|
* YEAR(dateValue)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Year::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Year class instead
|
||||||
|
*
|
||||||
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
*
|
*
|
||||||
|
|
@ -709,7 +776,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function YEAR($dateValue = 1)
|
public static function YEAR($dateValue = 1)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Year::funcYear($dateValue);
|
return DateTimeExcel\Year::evaluate($dateValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -718,11 +785,14 @@ class DateTime
|
||||||
* Returns the hour of a time value.
|
* Returns the hour of a time value.
|
||||||
* The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
|
* The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcHour method in the DateTimeExcel\Hour class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* HOUR(timeValue)
|
* HOUR(timeValue)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Hour::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Hour class instead
|
||||||
|
*
|
||||||
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard time string
|
* PHP DateTime object, or a standard time string
|
||||||
*
|
*
|
||||||
|
|
@ -730,7 +800,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function HOUROFDAY($timeValue = 0)
|
public static function HOUROFDAY($timeValue = 0)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Hour::funcHour($timeValue);
|
return DateTimeExcel\Hour::evaluate($timeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -739,11 +809,14 @@ class DateTime
|
||||||
* Returns the minutes of a time value.
|
* Returns the minutes of a time value.
|
||||||
* The minute is given as an integer, ranging from 0 to 59.
|
* The minute is given as an integer, ranging from 0 to 59.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcMinute method in the DateTimeExcel\Minute class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* MINUTE(timeValue)
|
* MINUTE(timeValue)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Minute::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Minute class instead
|
||||||
|
*
|
||||||
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard time string
|
* PHP DateTime object, or a standard time string
|
||||||
*
|
*
|
||||||
|
|
@ -751,7 +824,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function MINUTE($timeValue = 0)
|
public static function MINUTE($timeValue = 0)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Minute::funcMinute($timeValue);
|
return DateTimeExcel\Minute::evaluate($timeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -760,11 +833,14 @@ class DateTime
|
||||||
* Returns the seconds of a time value.
|
* Returns the seconds of a time value.
|
||||||
* The second is given as an integer in the range 0 (zero) to 59.
|
* The second is given as an integer in the range 0 (zero) to 59.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcSecond method in the DateTimeExcel\Second class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* SECOND(timeValue)
|
* SECOND(timeValue)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Second::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Second class instead
|
||||||
|
*
|
||||||
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $timeValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard time string
|
* PHP DateTime object, or a standard time string
|
||||||
*
|
*
|
||||||
|
|
@ -772,7 +848,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function SECOND($timeValue = 0)
|
public static function SECOND($timeValue = 0)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\Second::funcSecond($timeValue);
|
return DateTimeExcel\Second::evaluate($timeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -783,11 +859,14 @@ class DateTime
|
||||||
* Use EDATE to calculate maturity dates or due dates that fall on the same day of the month
|
* Use EDATE to calculate maturity dates or due dates that fall on the same day of the month
|
||||||
* as the date of issue.
|
* as the date of issue.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcEDate method in the DateTimeExcel\EDate class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* EDATE(dateValue,adjustmentMonths)
|
* EDATE(dateValue,adjustmentMonths)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\Edate::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\Edate class instead
|
||||||
|
*
|
||||||
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
* @param int $adjustmentMonths The number of months before or after start_date.
|
* @param int $adjustmentMonths The number of months before or after start_date.
|
||||||
|
|
@ -799,7 +878,7 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function EDATE($dateValue = 1, $adjustmentMonths = 0)
|
public static function EDATE($dateValue = 1, $adjustmentMonths = 0)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\EDate::funcEDate($dateValue, $adjustmentMonths);
|
return DateTimeExcel\EDate::evaluate($dateValue, $adjustmentMonths);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -809,11 +888,14 @@ class DateTime
|
||||||
* before or after start_date.
|
* before or after start_date.
|
||||||
* Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
|
* Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
|
||||||
*
|
*
|
||||||
* @Deprecated 2.0.0 Use the funcEoMonth method in the DateTimeExcel\EoMonth class instead
|
|
||||||
*
|
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* EOMONTH(dateValue,adjustmentMonths)
|
* EOMONTH(dateValue,adjustmentMonths)
|
||||||
*
|
*
|
||||||
|
* @Deprecated 1.18.0
|
||||||
|
*
|
||||||
|
* @See DateTimeExcel\EoMonth::evaluate()
|
||||||
|
* Use the evaluate method in the DateTimeExcel\EoMonth class instead
|
||||||
|
*
|
||||||
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
* @param int $adjustmentMonths The number of months before or after start_date.
|
* @param int $adjustmentMonths The number of months before or after start_date.
|
||||||
|
|
@ -825,6 +907,6 @@ class DateTime
|
||||||
*/
|
*/
|
||||||
public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0)
|
public static function EOMONTH($dateValue = 1, $adjustmentMonths = 0)
|
||||||
{
|
{
|
||||||
return DateTimeExcel\EoMonth::funcEoMonth($dateValue, $adjustmentMonths);
|
return DateTimeExcel\EoMonth::evaluate($dateValue, $adjustmentMonths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class DateDif
|
||||||
*
|
*
|
||||||
* @return int|string Interval between the dates
|
* @return int|string Interval between the dates
|
||||||
*/
|
*/
|
||||||
public static function funcDateDif($startDate, $endDate, $unit = 'D')
|
public static function evaluate($startDate, $endDate, $unit = 'D')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$startDate = Helpers::getDateValue($startDate);
|
$startDate = Helpers::getDateValue($startDate);
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,13 @@ class DateValue
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function funcDateValue($dateValue)
|
public static function evaluate($dateValue)
|
||||||
{
|
{
|
||||||
$dti = new DateTimeImmutable();
|
$dti = new DateTimeImmutable();
|
||||||
$baseYear = Date::getExcelCalendar();
|
$baseYear = Date::getExcelCalendar();
|
||||||
$dateValue = trim(Functions::flattenSingleValue($dateValue), '"');
|
$dateValue = trim(Functions::flattenSingleValue($dateValue), '"');
|
||||||
// Strip any ordinals because they're allowed in Excel (English only)
|
// Strip any ordinals because they're allowed in Excel (English only)
|
||||||
$dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue);
|
$dateValue = preg_replace('/(\d)(st|nd|rd|th)([ -\/])/Ui', '$1$3', $dateValue) ?? '';
|
||||||
// Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany)
|
// Convert separators (/ . or space) to hyphens (should also handle dot used for ordinals in some countries, e.g. Denmark, Germany)
|
||||||
$dateValue = str_replace(['/', '.', '-', ' '], ' ', $dateValue);
|
$dateValue = str_replace(['/', '.', '-', ' '], ' ', $dateValue);
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ class DateValue
|
||||||
}
|
}
|
||||||
if (count($t1) === 1) {
|
if (count($t1) === 1) {
|
||||||
// We've been fed a time value without any date
|
// We've been fed a time value without any date
|
||||||
return ((strpos($t, ':') === false)) ? Functions::Value() : 0.0;
|
return ((strpos((string) $t, ':') === false)) ? Functions::Value() : 0.0;
|
||||||
}
|
}
|
||||||
unset($t);
|
unset($t);
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ class DateValue
|
||||||
$testVal1 = strtok($dateValue, '- ');
|
$testVal1 = strtok($dateValue, '- ');
|
||||||
$testVal2 = strtok('- ');
|
$testVal2 = strtok('- ');
|
||||||
$testVal3 = strtok('- ') ?: $dti->format('Y');
|
$testVal3 = strtok('- ') ?: $dti->format('Y');
|
||||||
Helpers::adjustYear($testVal1, $testVal2, $testVal3);
|
Helpers::adjustYear((string) $testVal1, (string) $testVal2, $testVal3);
|
||||||
$PHPDateArray = date_parse($testVal1 . '-' . $testVal2 . '-' . $testVal3);
|
$PHPDateArray = date_parse($testVal1 . '-' . $testVal2 . '-' . $testVal3);
|
||||||
if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) {
|
if (($PHPDateArray === false) || ($PHPDateArray['error_count'] > 0)) {
|
||||||
$PHPDateArray = date_parse($testVal2 . '-' . $testVal1 . '-' . $testVal3);
|
$PHPDateArray = date_parse($testVal2 . '-' . $testVal1 . '-' . $testVal3);
|
||||||
|
|
@ -118,7 +118,7 @@ class DateValue
|
||||||
/**
|
/**
|
||||||
* Final results.
|
* Final results.
|
||||||
*
|
*
|
||||||
* @param array|false $PHPDateArray
|
* @param array|bool $PHPDateArray
|
||||||
*
|
*
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
|
|
@ -126,7 +126,7 @@ class DateValue
|
||||||
private static function finalResults($PHPDateArray, DateTimeImmutable $dti, int $baseYear)
|
private static function finalResults($PHPDateArray, DateTimeImmutable $dti, int $baseYear)
|
||||||
{
|
{
|
||||||
$retValue = Functions::Value();
|
$retValue = Functions::Value();
|
||||||
if (($PHPDateArray !== false) && ($PHPDateArray['error_count'] == 0)) {
|
if (is_array($PHPDateArray) && $PHPDateArray['error_count'] == 0) {
|
||||||
// Execute function
|
// Execute function
|
||||||
Helpers::replaceIfEmpty($PHPDateArray['year'], $dti->format('Y'));
|
Helpers::replaceIfEmpty($PHPDateArray['year'], $dti->format('Y'));
|
||||||
if ($PHPDateArray['year'] < $baseYear) {
|
if ($PHPDateArray['year'] < $baseYear) {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class Datefunc
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function funcDate($year, $month, $day)
|
public static function evaluate($year, $month, $day)
|
||||||
{
|
{
|
||||||
$baseYear = Date::getExcelCalendar();
|
$baseYear = Date::getExcelCalendar();
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ class Datefunc
|
||||||
private static function getYear($year, int $baseYear): int
|
private static function getYear($year, int $baseYear): int
|
||||||
{
|
{
|
||||||
$year = Functions::flattenSingleValue($year);
|
$year = Functions::flattenSingleValue($year);
|
||||||
$year = ($year !== null) ? StringHelper::testStringAsNumeric($year) : 0;
|
$year = ($year !== null) ? StringHelper::testStringAsNumeric((string) $year) : 0;
|
||||||
if (!is_numeric($year)) {
|
if (!is_numeric($year)) {
|
||||||
throw new Exception(Functions::VALUE());
|
throw new Exception(Functions::VALUE());
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +118,7 @@ class Datefunc
|
||||||
$month = Date::monthStringToNumber($month);
|
$month = Date::monthStringToNumber($month);
|
||||||
}
|
}
|
||||||
|
|
||||||
$month = ($month !== null) ? StringHelper::testStringAsNumeric($month) : 0;
|
$month = ($month !== null) ? StringHelper::testStringAsNumeric((string) $month) : 0;
|
||||||
if (!is_numeric($month)) {
|
if (!is_numeric($month)) {
|
||||||
throw new Exception(Functions::VALUE());
|
throw new Exception(Functions::VALUE());
|
||||||
}
|
}
|
||||||
|
|
@ -139,7 +139,7 @@ class Datefunc
|
||||||
$day = Date::dayStringToNumber($day);
|
$day = Date::dayStringToNumber($day);
|
||||||
}
|
}
|
||||||
|
|
||||||
$day = ($day !== null) ? StringHelper::testStringAsNumeric($day) : 0;
|
$day = ($day !== null) ? StringHelper::testStringAsNumeric((string) $day) : 0;
|
||||||
if (!is_numeric($day)) {
|
if (!is_numeric($day)) {
|
||||||
throw new Exception(Functions::VALUE());
|
throw new Exception(Functions::VALUE());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class Day
|
||||||
*
|
*
|
||||||
* @return int|string Day of the month
|
* @return int|string Day of the month
|
||||||
*/
|
*/
|
||||||
public static function funcDay($dateValue)
|
public static function evaluate($dateValue)
|
||||||
{
|
{
|
||||||
$weirdResult = self::weirdCondition($dateValue);
|
$weirdResult = self::weirdCondition($dateValue);
|
||||||
if ($weirdResult >= 0) {
|
if ($weirdResult >= 0) {
|
||||||
|
|
@ -41,6 +41,10 @@ class Day
|
||||||
return (int) $PHPDateObject->format('j');
|
return (int) $PHPDateObject->format('j');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
|
* PHP DateTime object, or a standard date string
|
||||||
|
*/
|
||||||
private static function weirdCondition($dateValue): int
|
private static function weirdCondition($dateValue): int
|
||||||
{
|
{
|
||||||
// Excel does not treat 0 consistently for DAY vs. (MONTH or YEAR)
|
// Excel does not treat 0 consistently for DAY vs. (MONTH or YEAR)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class Days
|
||||||
*
|
*
|
||||||
* @return int|string Number of days between start date and end date or an error
|
* @return int|string Number of days between start date and end date or an error
|
||||||
*/
|
*/
|
||||||
public static function funcDays($endDate, $startDate)
|
public static function evaluate($endDate, $startDate)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$startDate = Helpers::getDateValue($startDate);
|
$startDate = Helpers::getDateValue($startDate);
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class Days360
|
||||||
*
|
*
|
||||||
* @return int|string Number of days between start date and end date
|
* @return int|string Number of days between start date and end date
|
||||||
*/
|
*/
|
||||||
public static function funcDays360($startDate = 0, $endDate = 0, $method = false)
|
public static function evaluate($startDate = 0, $endDate = 0, $method = false)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$startDate = Helpers::getDateValue($startDate);
|
$startDate = Helpers::getDateValue($startDate);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class EDate
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function funcEDate($dateValue, $adjustmentMonths)
|
public static function evaluate($dateValue, $adjustmentMonths)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dateValue = Helpers::getDateValue($dateValue, false);
|
$dateValue = Helpers::getDateValue($dateValue, false);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class EoMonth
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function funcEoMonth($dateValue, $adjustmentMonths)
|
public static function evaluate($dateValue, $adjustmentMonths)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dateValue = Helpers::getDateValue($dateValue, false);
|
$dateValue = Helpers::getDateValue($dateValue, false);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class Helpers
|
||||||
if (!is_numeric($dateValue)) {
|
if (!is_numeric($dateValue)) {
|
||||||
$saveReturnDateType = Functions::getReturnDateType();
|
$saveReturnDateType = Functions::getReturnDateType();
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
||||||
$dateValue = DateValue::funcDateValue($dateValue);
|
$dateValue = DateValue::evaluate($dateValue);
|
||||||
Functions::setReturnDateType($saveReturnDateType);
|
Functions::setReturnDateType($saveReturnDateType);
|
||||||
if (!is_numeric($dateValue)) {
|
if (!is_numeric($dateValue)) {
|
||||||
throw new Exception(Functions::VALUE());
|
throw new Exception(Functions::VALUE());
|
||||||
|
|
@ -67,13 +67,18 @@ class Helpers
|
||||||
{
|
{
|
||||||
$saveReturnDateType = Functions::getReturnDateType();
|
$saveReturnDateType = Functions::getReturnDateType();
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
||||||
$timeValue = TimeValue::funcTimeValue($timeValue);
|
$timeValue = TimeValue::evaluate($timeValue);
|
||||||
Functions::setReturnDateType($saveReturnDateType);
|
Functions::setReturnDateType($saveReturnDateType);
|
||||||
|
|
||||||
return $timeValue;
|
return $timeValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function adjustDateByMonths($dateValue = 0, $adjustmentMonths = 0)
|
/**
|
||||||
|
* Adjust date by given months.
|
||||||
|
*
|
||||||
|
* @param mixed $dateValue
|
||||||
|
*/
|
||||||
|
public static function adjustDateByMonths($dateValue = 0, float $adjustmentMonths = 0): DateTime
|
||||||
{
|
{
|
||||||
// Execute function
|
// Execute function
|
||||||
$PHPDateObject = Date::excelToDateTimeObject($dateValue);
|
$PHPDateObject = Date::excelToDateTimeObject($dateValue);
|
||||||
|
|
@ -194,8 +199,10 @@ class Helpers
|
||||||
return (float) Date::PHPToExcel($PHPDateObject);
|
return (float) Date::PHPToExcel($PHPDateObject);
|
||||||
}
|
}
|
||||||
// RETURNDATE_UNIX_TIMESTAMP
|
// RETURNDATE_UNIX_TIMESTAMP
|
||||||
|
$stamp = Date::PHPToExcel($PHPDateObject);
|
||||||
|
$stamp = is_bool($stamp) ? ((int) $stamp) : $stamp;
|
||||||
|
|
||||||
return (int) Date::excelToTimestamp(Date::PHPToExcel($PHPDateObject));
|
return (int) Date::excelToTimestamp($stamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function baseDate(): int
|
private static function baseDate(): int
|
||||||
|
|
@ -239,9 +246,12 @@ class Helpers
|
||||||
if ($number === null) {
|
if ($number === null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (is_numeric($number)) {
|
if (is_int($number)) {
|
||||||
return $number;
|
return $number;
|
||||||
}
|
}
|
||||||
|
if (is_numeric($number)) {
|
||||||
|
return (float) $number;
|
||||||
|
}
|
||||||
|
|
||||||
throw new Exception(Functions::VALUE());
|
throw new Exception(Functions::VALUE());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class Hour
|
||||||
*
|
*
|
||||||
* @return int|string Hour
|
* @return int|string Hour
|
||||||
*/
|
*/
|
||||||
public static function funcHour($timeValue)
|
public static function evaluate($timeValue)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$timeValue = Functions::flattenSingleValue($timeValue);
|
$timeValue = Functions::flattenSingleValue($timeValue);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class IsoWeekNum
|
||||||
*
|
*
|
||||||
* @return int|string Week Number
|
* @return int|string Week Number
|
||||||
*/
|
*/
|
||||||
public static function funcIsoWeekNum($dateValue)
|
public static function evaluate($dateValue)
|
||||||
{
|
{
|
||||||
if (self::apparentBug($dateValue)) {
|
if (self::apparentBug($dateValue)) {
|
||||||
return 52;
|
return 52;
|
||||||
|
|
@ -39,6 +39,10 @@ class IsoWeekNum
|
||||||
return (int) $PHPDateObject->format('W');
|
return (int) $PHPDateObject->format('W');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
|
* PHP DateTime object, or a standard date string
|
||||||
|
*/
|
||||||
private static function apparentBug($dateValue): bool
|
private static function apparentBug($dateValue): bool
|
||||||
{
|
{
|
||||||
if (Date::getExcelCalendar() !== DATE::CALENDAR_MAC_1904) {
|
if (Date::getExcelCalendar() !== DATE::CALENDAR_MAC_1904) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class Minute
|
||||||
*
|
*
|
||||||
* @return int|string Minute
|
* @return int|string Minute
|
||||||
*/
|
*/
|
||||||
public static function funcMinute($timeValue)
|
public static function evaluate($timeValue)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$timeValue = Functions::flattenSingleValue($timeValue);
|
$timeValue = Functions::flattenSingleValue($timeValue);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class Month
|
||||||
*
|
*
|
||||||
* @return int|string Month of the year
|
* @return int|string Month of the year
|
||||||
*/
|
*/
|
||||||
public static function funcMonth($dateValue)
|
public static function evaluate($dateValue)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dateValue = Helpers::getDateValue($dateValue);
|
$dateValue = Helpers::getDateValue($dateValue);
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,11 @@ class NetworkDays
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
|
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
|
* @param mixed $dateArgs
|
||||||
*
|
*
|
||||||
* @return int|string Interval between the dates
|
* @return int|string Interval between the dates
|
||||||
*/
|
*/
|
||||||
public static function funcNetworkDays($startDate, $endDate, ...$dateArgs)
|
public static function evaluate($startDate, $endDate, ...$dateArgs)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// Retrieve the mandatory start and end date that are referenced in the function definition
|
// Retrieve the mandatory start and end date that are referenced in the function definition
|
||||||
|
|
@ -55,7 +56,7 @@ class NetworkDays
|
||||||
$holidayCountedArray = [];
|
$holidayCountedArray = [];
|
||||||
foreach ($holidayArray as $holidayDate) {
|
foreach ($holidayArray as $holidayDate) {
|
||||||
if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
|
if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
|
||||||
if ((WeekDay::funcWeekDay($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
|
if ((WeekDay::evaluate($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
|
||||||
--$partWeekDays;
|
--$partWeekDays;
|
||||||
$holidayCountedArray[] = $holidayDate;
|
$holidayCountedArray[] = $holidayDate;
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +68,7 @@ class NetworkDays
|
||||||
|
|
||||||
private static function calcStartDow(float $startDate): int
|
private static function calcStartDow(float $startDate): int
|
||||||
{
|
{
|
||||||
$startDow = 6 - (int) WeekDay::funcWeekDay($startDate, 2);
|
$startDow = 6 - (int) WeekDay::evaluate($startDate, 2);
|
||||||
if ($startDow < 0) {
|
if ($startDow < 0) {
|
||||||
$startDow = 5;
|
$startDow = 5;
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +78,7 @@ class NetworkDays
|
||||||
|
|
||||||
private static function calcEndDow(float $endDate): int
|
private static function calcEndDow(float $endDate): int
|
||||||
{
|
{
|
||||||
$endDow = (int) WeekDay::funcWeekDay($endDate, 2);
|
$endDow = (int) WeekDay::evaluate($endDate, 2);
|
||||||
if ($endDow >= 6) {
|
if ($endDow >= 6) {
|
||||||
$endDow = 0;
|
$endDow = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -95,7 +96,7 @@ class NetworkDays
|
||||||
return $partWeekDays;
|
return $partWeekDays;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function applySign(int $result, float $sDate, float $eDate)
|
private static function applySign(int $result, float $sDate, float $eDate): int
|
||||||
{
|
{
|
||||||
return ($sDate > $eDate) ? -$result : $result;
|
return ($sDate > $eDate) ? -$result : $result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class Now
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function funcNow()
|
public static function evaluate()
|
||||||
{
|
{
|
||||||
$dti = new DateTimeImmutable();
|
$dti = new DateTimeImmutable();
|
||||||
$dateArray = date_parse($dti->format('c'));
|
$dateArray = date_parse($dti->format('c'));
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class Second
|
||||||
*
|
*
|
||||||
* @return int|string Minute
|
* @return int|string Minute
|
||||||
*/
|
*/
|
||||||
public static function funcSecond($timeValue)
|
public static function evaluate($timeValue)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$timeValue = Functions::flattenSingleValue($timeValue);
|
$timeValue = Functions::flattenSingleValue($timeValue);
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,14 @@ class Time
|
||||||
* Excel Function:
|
* Excel Function:
|
||||||
* TIME(hour,minute,second)
|
* TIME(hour,minute,second)
|
||||||
*
|
*
|
||||||
* @param int $hour A number from 0 (zero) to 32767 representing the hour.
|
* @param mixed $hour A number from 0 (zero) to 32767 representing the hour.
|
||||||
* Any value greater than 23 will be divided by 24 and the remainder
|
* Any value greater than 23 will be divided by 24 and the remainder
|
||||||
* will be treated as the hour value. For example, TIME(27,0,0) =
|
* will be treated as the hour value. For example, TIME(27,0,0) =
|
||||||
* TIME(3,0,0) = .125 or 3:00 AM.
|
* TIME(3,0,0) = .125 or 3:00 AM.
|
||||||
* @param int $minute A number from 0 to 32767 representing the minute.
|
* @param mixed $minute A number from 0 to 32767 representing the minute.
|
||||||
* Any value greater than 59 will be converted to hours and minutes.
|
* Any value greater than 59 will be converted to hours and minutes.
|
||||||
* For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM.
|
* For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM.
|
||||||
* @param int $second A number from 0 to 32767 representing the second.
|
* @param mixed $second A number from 0 to 32767 representing the second.
|
||||||
* Any value greater than 59 will be converted to hours, minutes,
|
* Any value greater than 59 will be converted to hours, minutes,
|
||||||
* and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148
|
* and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148
|
||||||
* or 12:33:20 AM
|
* or 12:33:20 AM
|
||||||
|
|
@ -35,7 +35,7 @@ class Time
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function funcTime($hour, $minute, $second)
|
public static function evaluate($hour, $minute, $second)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$hour = self::toIntWithNullBool($hour);
|
$hour = self::toIntWithNullBool($hour);
|
||||||
|
|
@ -100,6 +100,9 @@ class Time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $value expect int
|
||||||
|
*/
|
||||||
private static function toIntWithNullBool($value): int
|
private static function toIntWithNullBool($value): int
|
||||||
{
|
{
|
||||||
$value = Functions::flattenSingleValue($value);
|
$value = Functions::flattenSingleValue($value);
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,12 @@ class TimeValue
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function funcTimeValue($timeValue)
|
public static function evaluate($timeValue)
|
||||||
{
|
{
|
||||||
$timeValue = trim(Functions::flattenSingleValue($timeValue), '"');
|
$timeValue = trim(Functions::flattenSingleValue($timeValue), '"');
|
||||||
$timeValue = str_replace(['/', '.'], '-', $timeValue);
|
$timeValue = str_replace(['/', '.'], '-', $timeValue);
|
||||||
|
|
||||||
$arraySplit = preg_split('/[\/:\-\s]/', $timeValue);
|
$arraySplit = preg_split('/[\/:\-\s]/', $timeValue) ?: [];
|
||||||
if ((count($arraySplit) == 2 || count($arraySplit) == 3) && $arraySplit[0] > 24) {
|
if ((count($arraySplit) == 2 || count($arraySplit) == 3) && $arraySplit[0] > 24) {
|
||||||
$arraySplit[0] = ($arraySplit[0] % 24);
|
$arraySplit[0] = ($arraySplit[0] % 24);
|
||||||
$timeValue = implode(':', $arraySplit);
|
$timeValue = implode(':', $arraySplit);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class Today
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function funcToday()
|
public static function evaluate()
|
||||||
{
|
{
|
||||||
$dti = new DateTimeImmutable();
|
$dti = new DateTimeImmutable();
|
||||||
$dateArray = date_parse($dti->format('c'));
|
$dateArray = date_parse($dti->format('c'));
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,14 @@ class WeekDay
|
||||||
*
|
*
|
||||||
* @param null|float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
* @param null|float|int|string $dateValue Excel date serial value (float), PHP date timestamp (integer),
|
||||||
* PHP DateTime object, or a standard date string
|
* PHP DateTime object, or a standard date string
|
||||||
* @param int $style A number that determines the type of return value
|
* @param mixed $style A number that determines the type of return value
|
||||||
* 1 or omitted Numbers 1 (Sunday) through 7 (Saturday).
|
* 1 or omitted Numbers 1 (Sunday) through 7 (Saturday).
|
||||||
* 2 Numbers 1 (Monday) through 7 (Sunday).
|
* 2 Numbers 1 (Monday) through 7 (Sunday).
|
||||||
* 3 Numbers 0 (Monday) through 6 (Sunday).
|
* 3 Numbers 0 (Monday) through 6 (Sunday).
|
||||||
*
|
*
|
||||||
* @return int|string Day of the week value
|
* @return int|string Day of the week value
|
||||||
*/
|
*/
|
||||||
public static function funcWeekDay($dateValue, $style = 1)
|
public static function evaluate($dateValue, $style = 1)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dateValue = Helpers::getDateValue($dateValue);
|
$dateValue = Helpers::getDateValue($dateValue);
|
||||||
|
|
@ -58,6 +58,9 @@ class WeekDay
|
||||||
return $DoW;
|
return $DoW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $style expect int
|
||||||
|
*/
|
||||||
private static function validateStyle($style): int
|
private static function validateStyle($style): int
|
||||||
{
|
{
|
||||||
$style = Functions::flattenSingleValue($style);
|
$style = Functions::flattenSingleValue($style);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class WeekNum
|
||||||
*
|
*
|
||||||
* @return int|string Week Number
|
* @return int|string Week Number
|
||||||
*/
|
*/
|
||||||
public static function funcWeekNum($dateValue, $method = Constants::STARTWEEK_SUNDAY)
|
public static function evaluate($dateValue, $method = Constants::STARTWEEK_SUNDAY)
|
||||||
{
|
{
|
||||||
$origDateValueNull = empty($dateValue);
|
$origDateValueNull = empty($dateValue);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,12 @@ class WorkDay
|
||||||
* @param int $endDays The number of nonweekend and nonholiday days before or after
|
* @param int $endDays The number of nonweekend and nonholiday days before or after
|
||||||
* startDate. A positive value for days yields a future date; a
|
* startDate. A positive value for days yields a future date; a
|
||||||
* negative value yields a past date.
|
* negative value yields a past date.
|
||||||
|
* @param mixed $dateArgs
|
||||||
*
|
*
|
||||||
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
|
||||||
* depending on the value of the ReturnDateType flag
|
* depending on the value of the ReturnDateType flag
|
||||||
*/
|
*/
|
||||||
public static function funcWorkDay($startDate, $endDays, ...$dateArgs)
|
public static function evaluate($startDate, $endDays, ...$dateArgs)
|
||||||
{
|
{
|
||||||
// Retrieve the mandatory start date and days that are referenced in the function definition
|
// Retrieve the mandatory start date and days that are referenced in the function definition
|
||||||
try {
|
try {
|
||||||
|
|
@ -65,8 +66,8 @@ class WorkDay
|
||||||
{
|
{
|
||||||
// Adjust the start date if it falls over a weekend
|
// Adjust the start date if it falls over a weekend
|
||||||
|
|
||||||
$startDoW = WeekDay::funcWeekDay($startDate, 3);
|
$startDoW = self::getWeekDay($startDate, 3);
|
||||||
if (WeekDay::funcWeekDay($startDate, 3) >= 5) {
|
if (self::getWeekDay($startDate, 3) >= 5) {
|
||||||
$startDate += 7 - $startDoW;
|
$startDate += 7 - $startDoW;
|
||||||
--$endDays;
|
--$endDays;
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +78,7 @@ class WorkDay
|
||||||
while ($endDays > 0) {
|
while ($endDays > 0) {
|
||||||
++$endDate;
|
++$endDate;
|
||||||
// Adjust the calculated end date if it falls over a weekend
|
// Adjust the calculated end date if it falls over a weekend
|
||||||
$endDow = WeekDay::funcWeekDay($endDate, 3);
|
$endDow = self::getWeekDay($endDate, 3);
|
||||||
if ($endDow >= 5) {
|
if ($endDow >= 5) {
|
||||||
$endDate += 7 - $endDow;
|
$endDate += 7 - $endDow;
|
||||||
}
|
}
|
||||||
|
|
@ -96,7 +97,7 @@ class WorkDay
|
||||||
{
|
{
|
||||||
$holidayCountedArray = $holidayDates = [];
|
$holidayCountedArray = $holidayDates = [];
|
||||||
foreach ($holidayArray as $holidayDate) {
|
foreach ($holidayArray as $holidayDate) {
|
||||||
if (WeekDay::funcWeekDay($holidayDate, 3) < 5) {
|
if (self::getWeekDay($holidayDate, 3) < 5) {
|
||||||
$holidayDates[] = $holidayDate;
|
$holidayDates[] = $holidayDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +110,7 @@ class WorkDay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Adjust the calculated end date if it falls over a weekend
|
// Adjust the calculated end date if it falls over a weekend
|
||||||
$endDoW = WeekDay::funcWeekDay($endDate, 3);
|
$endDoW = self::getWeekDay($endDate, 3);
|
||||||
if ($endDoW >= 5) {
|
if ($endDoW >= 5) {
|
||||||
$endDate += 7 - $endDoW;
|
$endDate += 7 - $endDoW;
|
||||||
}
|
}
|
||||||
|
|
@ -127,9 +128,8 @@ class WorkDay
|
||||||
{
|
{
|
||||||
// Adjust the start date if it falls over a weekend
|
// Adjust the start date if it falls over a weekend
|
||||||
|
|
||||||
$startDoW = WeekDay::funcWeekDay($startDate, 3);
|
$startDoW = self::getWeekDay($startDate, 3);
|
||||||
if (WeekDay::funcWeekDay($startDate, 3) >= 5) {
|
if (self::getWeekDay($startDate, 3) >= 5) {
|
||||||
// @phpstan-ignore-next-line
|
|
||||||
$startDate += -$startDoW + 4;
|
$startDate += -$startDoW + 4;
|
||||||
++$endDays;
|
++$endDays;
|
||||||
}
|
}
|
||||||
|
|
@ -140,7 +140,7 @@ class WorkDay
|
||||||
while ($endDays < 0) {
|
while ($endDays < 0) {
|
||||||
--$endDate;
|
--$endDate;
|
||||||
// Adjust the calculated end date if it falls over a weekend
|
// Adjust the calculated end date if it falls over a weekend
|
||||||
$endDow = WeekDay::funcWeekDay($endDate, 3);
|
$endDow = self::getWeekDay($endDate, 3);
|
||||||
if ($endDow >= 5) {
|
if ($endDow >= 5) {
|
||||||
$endDate += 4 - $endDow;
|
$endDate += 4 - $endDow;
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +159,7 @@ class WorkDay
|
||||||
{
|
{
|
||||||
$holidayCountedArray = $holidayDates = [];
|
$holidayCountedArray = $holidayDates = [];
|
||||||
foreach ($holidayArray as $holidayDate) {
|
foreach ($holidayArray as $holidayDate) {
|
||||||
if (WeekDay::funcWeekDay($holidayDate, 3) < 5) {
|
if (self::getWeekDay($holidayDate, 3) < 5) {
|
||||||
$holidayDates[] = $holidayDate;
|
$holidayDates[] = $holidayDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -172,13 +172,19 @@ class WorkDay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Adjust the calculated end date if it falls over a weekend
|
// Adjust the calculated end date if it falls over a weekend
|
||||||
$endDoW = WeekDay::funcWeekDay($endDate, 3);
|
$endDoW = self::getWeekDay($endDate, 3);
|
||||||
if ($endDoW >= 5) {
|
if ($endDoW >= 5) {
|
||||||
// @phpstan-ignore-next-line
|
|
||||||
$endDate += -$endDoW + 4;
|
$endDate += -$endDoW + 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $endDate;
|
return $endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function getWeekDay(float $date, int $wd): int
|
||||||
|
{
|
||||||
|
$result = WeekDay::evaluate($date, $wd);
|
||||||
|
|
||||||
|
return is_string($result) ? -1 : $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class Year
|
||||||
*
|
*
|
||||||
* @return int|string Year
|
* @return int|string Year
|
||||||
*/
|
*/
|
||||||
public static function funcYear($dateValue)
|
public static function evaluate($dateValue)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dateValue = Helpers::getDateValue($dateValue);
|
$dateValue = Helpers::getDateValue($dateValue);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class YearFrac
|
||||||
*
|
*
|
||||||
* @return float|string fraction of the year, or a string containing an error
|
* @return float|string fraction of the year, or a string containing an error
|
||||||
*/
|
*/
|
||||||
public static function funcYearFrac($startDate, $endDate, $method = 0)
|
public static function evaluate($startDate, $endDate, $method = 0)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$method = (int) Helpers::validateNumericNull($method);
|
$method = (int) Helpers::validateNumericNull($method);
|
||||||
|
|
@ -50,15 +50,15 @@ class YearFrac
|
||||||
|
|
||||||
switch ($method) {
|
switch ($method) {
|
||||||
case 0:
|
case 0:
|
||||||
return Days360::funcDays360($startDate, $endDate) / 360;
|
return Days360::evaluate($startDate, $endDate) / 360;
|
||||||
case 1:
|
case 1:
|
||||||
return self::method1($startDate, $endDate);
|
return self::method1($startDate, $endDate);
|
||||||
case 2:
|
case 2:
|
||||||
return DateDif::funcDateDif($startDate, $endDate) / 360;
|
return DateDif::evaluate($startDate, $endDate) / 360;
|
||||||
case 3:
|
case 3:
|
||||||
return DateDif::funcDateDif($startDate, $endDate) / 365;
|
return DateDif::evaluate($startDate, $endDate) / 365;
|
||||||
case 4:
|
case 4:
|
||||||
return Days360::funcDays360($startDate, $endDate, true) / 360;
|
return Days360::evaluate($startDate, $endDate, true) / 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Functions::NAN();
|
return Functions::NAN();
|
||||||
|
|
@ -74,7 +74,7 @@ class YearFrac
|
||||||
{
|
{
|
||||||
if (Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_OPENOFFICE && Date::getExcelCalendar() !== Date::CALENDAR_MAC_1904) {
|
if (Functions::getCompatibilityMode() !== Functions::COMPATIBILITY_OPENOFFICE && Date::getExcelCalendar() !== Date::CALENDAR_MAC_1904) {
|
||||||
if ($endDate === null && $startDate !== null) {
|
if ($endDate === null && $startDate !== null) {
|
||||||
if (Month::funcMonth($sDate) == 12 && Day::funcDay($sDate) === 31 && $method === 0) {
|
if (Month::evaluate($sDate) == 12 && Day::evaluate($sDate) === 31 && $method === 0) {
|
||||||
$sDate += 2;
|
$sDate += 2;
|
||||||
} else {
|
} else {
|
||||||
++$sDate;
|
++$sDate;
|
||||||
|
|
@ -87,14 +87,14 @@ class YearFrac
|
||||||
|
|
||||||
private static function method1(float $startDate, float $endDate): float
|
private static function method1(float $startDate, float $endDate): float
|
||||||
{
|
{
|
||||||
$days = DateDif::funcDateDif($startDate, $endDate);
|
$days = DateDif::evaluate($startDate, $endDate);
|
||||||
$startYear = Year::funcYear($startDate);
|
$startYear = (int) Year::evaluate($startDate);
|
||||||
$endYear = Year::funcYear($endDate);
|
$endYear = (int) Year::evaluate($endDate);
|
||||||
$years = $endYear - $startYear + 1;
|
$years = $endYear - $startYear + 1;
|
||||||
$startMonth = Month::funcMonth($startDate);
|
$startMonth = (int) Month::evaluate($startDate);
|
||||||
$startDay = Day::funcDay($startDate);
|
$startDay = (int) Day::evaluate($startDate);
|
||||||
$endMonth = Month::funcMonth($endDate);
|
$endMonth = (int) Month::evaluate($endDate);
|
||||||
$endDay = Day::funcDay($endDate);
|
$endDay = (int) Day::evaluate($endDate);
|
||||||
$startMonthDay = 100 * $startMonth + $startDay;
|
$startMonthDay = 100 * $startMonth + $startDay;
|
||||||
$endMonthDay = 100 * $endMonth + $endDay;
|
$endMonthDay = 100 * $endMonth + $endDay;
|
||||||
if ($years == 1) {
|
if ($years == 1) {
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class Amortization
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$yearFrac = DateTimeExcel\YearFrac::funcYearFrac($purchased, $firstPeriod, $basis);
|
$yearFrac = DateTimeExcel\YearFrac::evaluate($purchased, $firstPeriod, $basis);
|
||||||
if (is_string($yearFrac)) {
|
if (is_string($yearFrac)) {
|
||||||
return $yearFrac;
|
return $yearFrac;
|
||||||
}
|
}
|
||||||
|
|
@ -160,8 +160,8 @@ class Amortization
|
||||||
$fOneRate = $cost * $rate;
|
$fOneRate = $cost * $rate;
|
||||||
$fCostDelta = $cost - $salvage;
|
$fCostDelta = $cost - $salvage;
|
||||||
// Note, quirky variation for leap years on the YEARFRAC for this function
|
// Note, quirky variation for leap years on the YEARFRAC for this function
|
||||||
$purchasedYear = DateTimeExcel\Year::funcYear($purchased);
|
$purchasedYear = DateTimeExcel\Year::evaluate($purchased);
|
||||||
$yearFrac = DateTimeExcel\YearFrac::funcYearFrac($purchased, $firstPeriod, $basis);
|
$yearFrac = DateTimeExcel\YearFrac::evaluate($purchased, $firstPeriod, $basis);
|
||||||
if (is_string($yearFrac)) {
|
if (is_string($yearFrac)) {
|
||||||
return $yearFrac;
|
return $yearFrac;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -196,10 +196,9 @@ class NonPeriodic
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
if ($date0 > $datei) {
|
if ($date0 > $datei) {
|
||||||
/** @phpstan-ignore-next-line */
|
$dif = $ordered ? Functions::NAN() : -((int) DateTimeExcel\DateDif::evaluate($datei, $date0, 'd'));
|
||||||
$dif = $ordered ? Functions::NAN() : -DateTimeExcel\DateDif::funcDateDif($datei, $date0, 'd');
|
|
||||||
} else {
|
} else {
|
||||||
$dif = DateTimeExcel\DateDif::funcDateDif($date0, $datei, 'd');
|
$dif = DateTimeExcel\DateDif::evaluate($date0, $datei, 'd');
|
||||||
}
|
}
|
||||||
if (!is_numeric($dif)) {
|
if (!is_numeric($dif)) {
|
||||||
return $dif;
|
return $dif;
|
||||||
|
|
|
||||||
|
|
@ -63,17 +63,17 @@ class Coupons
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
|
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::evaluate($settlement), $basis);
|
||||||
if (is_string($daysPerYear)) {
|
if (is_string($daysPerYear)) {
|
||||||
return Functions::VALUE();
|
return Functions::VALUE();
|
||||||
}
|
}
|
||||||
$prev = self::couponFirstPeriodDate($settlement, $maturity, $frequency, self::PERIOD_DATE_PREVIOUS);
|
$prev = self::couponFirstPeriodDate($settlement, $maturity, $frequency, self::PERIOD_DATE_PREVIOUS);
|
||||||
|
|
||||||
if ($basis === FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL) {
|
if ($basis === FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL) {
|
||||||
return abs(DateTimeExcel\Days::funcDays($prev, $settlement));
|
return abs((float) DateTimeExcel\Days::evaluate($prev, $settlement));
|
||||||
}
|
}
|
||||||
|
|
||||||
return DateTimeExcel\YearFrac::funcYearFrac($prev, $settlement, $basis) * $daysPerYear;
|
return DateTimeExcel\YearFrac::evaluate($prev, $settlement, $basis) * $daysPerYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -133,7 +133,7 @@ class Coupons
|
||||||
case FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL:
|
case FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL:
|
||||||
// Actual/actual
|
// Actual/actual
|
||||||
if ($frequency == FinancialConstants::FREQUENCY_ANNUAL) {
|
if ($frequency == FinancialConstants::FREQUENCY_ANNUAL) {
|
||||||
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
|
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::evaluate($settlement), $basis);
|
||||||
|
|
||||||
return $daysPerYear / $frequency;
|
return $daysPerYear / $frequency;
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +197,7 @@ class Coupons
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
|
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::evaluate($settlement), $basis);
|
||||||
$next = self::couponFirstPeriodDate($settlement, $maturity, $frequency, self::PERIOD_DATE_NEXT);
|
$next = self::couponFirstPeriodDate($settlement, $maturity, $frequency, self::PERIOD_DATE_NEXT);
|
||||||
|
|
||||||
if ($basis === FinancialConstants::BASIS_DAYS_PER_YEAR_NASD) {
|
if ($basis === FinancialConstants::BASIS_DAYS_PER_YEAR_NASD) {
|
||||||
|
|
@ -208,7 +208,7 @@ class Coupons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DateTimeExcel\YearFrac::funcYearFrac($settlement, $next, $basis) * $daysPerYear;
|
return DateTimeExcel\YearFrac::evaluate($settlement, $next, $basis) * $daysPerYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -316,7 +316,7 @@ class Coupons
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$yearsBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac(
|
$yearsBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::evaluate(
|
||||||
$settlement,
|
$settlement,
|
||||||
$maturity,
|
$maturity,
|
||||||
FinancialConstants::BASIS_DAYS_PER_YEAR_NASD
|
FinancialConstants::BASIS_DAYS_PER_YEAR_NASD
|
||||||
|
|
|
||||||
|
|
@ -78,12 +78,12 @@ class AccruedInterest
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$daysBetweenIssueAndSettlement = YearFrac::funcYearFrac($issue, $settlement, $basis);
|
$daysBetweenIssueAndSettlement = YearFrac::evaluate($issue, $settlement, $basis);
|
||||||
if (!is_numeric($daysBetweenIssueAndSettlement)) {
|
if (!is_numeric($daysBetweenIssueAndSettlement)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenIssueAndSettlement;
|
return $daysBetweenIssueAndSettlement;
|
||||||
}
|
}
|
||||||
$daysBetweenFirstInterestAndSettlement = YearFrac::funcYearFrac($firstInterest, $settlement, $basis);
|
$daysBetweenFirstInterestAndSettlement = YearFrac::evaluate($firstInterest, $settlement, $basis);
|
||||||
if (!is_numeric($daysBetweenFirstInterestAndSettlement)) {
|
if (!is_numeric($daysBetweenFirstInterestAndSettlement)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenFirstInterestAndSettlement;
|
return $daysBetweenFirstInterestAndSettlement;
|
||||||
|
|
@ -140,7 +140,7 @@ class AccruedInterest
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$daysBetweenIssueAndSettlement = YearFrac::funcYearFrac($issue, $settlement, $basis);
|
$daysBetweenIssueAndSettlement = YearFrac::evaluate($issue, $settlement, $basis);
|
||||||
if (!is_numeric($daysBetweenIssueAndSettlement)) {
|
if (!is_numeric($daysBetweenIssueAndSettlement)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenIssueAndSettlement;
|
return $daysBetweenIssueAndSettlement;
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ class Price
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
|
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::evaluate($settlement, $maturity, $basis);
|
||||||
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenSettlementAndMaturity;
|
return $daysBetweenSettlementAndMaturity;
|
||||||
|
|
@ -194,23 +194,23 @@ class Price
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
|
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::evaluate($settlement), $basis);
|
||||||
if (!is_numeric($daysPerYear)) {
|
if (!is_numeric($daysPerYear)) {
|
||||||
return $daysPerYear;
|
return $daysPerYear;
|
||||||
}
|
}
|
||||||
$daysBetweenIssueAndSettlement = DateTimeExcel\YearFrac::funcYearFrac($issue, $settlement, $basis);
|
$daysBetweenIssueAndSettlement = DateTimeExcel\YearFrac::evaluate($issue, $settlement, $basis);
|
||||||
if (!is_numeric($daysBetweenIssueAndSettlement)) {
|
if (!is_numeric($daysBetweenIssueAndSettlement)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenIssueAndSettlement;
|
return $daysBetweenIssueAndSettlement;
|
||||||
}
|
}
|
||||||
$daysBetweenIssueAndSettlement *= $daysPerYear;
|
$daysBetweenIssueAndSettlement *= $daysPerYear;
|
||||||
$daysBetweenIssueAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($issue, $maturity, $basis);
|
$daysBetweenIssueAndMaturity = DateTimeExcel\YearFrac::evaluate($issue, $maturity, $basis);
|
||||||
if (!is_numeric($daysBetweenIssueAndMaturity)) {
|
if (!is_numeric($daysBetweenIssueAndMaturity)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenIssueAndMaturity;
|
return $daysBetweenIssueAndMaturity;
|
||||||
}
|
}
|
||||||
$daysBetweenIssueAndMaturity *= $daysPerYear;
|
$daysBetweenIssueAndMaturity *= $daysPerYear;
|
||||||
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
|
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::evaluate($settlement, $maturity, $basis);
|
||||||
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenSettlementAndMaturity;
|
return $daysBetweenSettlementAndMaturity;
|
||||||
|
|
@ -272,7 +272,7 @@ class Price
|
||||||
if ($investment <= 0) {
|
if ($investment <= 0) {
|
||||||
return Functions::NAN();
|
return Functions::NAN();
|
||||||
}
|
}
|
||||||
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
|
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::evaluate($settlement, $maturity, $basis);
|
||||||
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenSettlementAndMaturity;
|
return $daysBetweenSettlementAndMaturity;
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class Rates
|
||||||
return Functions::NAN();
|
return Functions::NAN();
|
||||||
}
|
}
|
||||||
|
|
||||||
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
|
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::evaluate($settlement, $maturity, $basis);
|
||||||
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenSettlementAndMaturity;
|
return $daysBetweenSettlementAndMaturity;
|
||||||
|
|
@ -126,7 +126,7 @@ class Rates
|
||||||
return Functions::NAN();
|
return Functions::NAN();
|
||||||
}
|
}
|
||||||
|
|
||||||
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
|
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::evaluate($settlement, $maturity, $basis);
|
||||||
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenSettlementAndMaturity;
|
return $daysBetweenSettlementAndMaturity;
|
||||||
|
|
|
||||||
|
|
@ -57,11 +57,11 @@ class Yields
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
|
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::evaluate($settlement), $basis);
|
||||||
if (!is_numeric($daysPerYear)) {
|
if (!is_numeric($daysPerYear)) {
|
||||||
return $daysPerYear;
|
return $daysPerYear;
|
||||||
}
|
}
|
||||||
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
|
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::evaluate($settlement, $maturity, $basis);
|
||||||
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenSettlementAndMaturity;
|
return $daysBetweenSettlementAndMaturity;
|
||||||
|
|
@ -122,23 +122,23 @@ class Yields
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::funcYear($settlement), $basis);
|
$daysPerYear = Helpers::daysPerYear(DateTimeExcel\Year::evaluate($settlement), $basis);
|
||||||
if (!is_numeric($daysPerYear)) {
|
if (!is_numeric($daysPerYear)) {
|
||||||
return $daysPerYear;
|
return $daysPerYear;
|
||||||
}
|
}
|
||||||
$daysBetweenIssueAndSettlement = DateTimeExcel\YearFrac::funcYearFrac($issue, $settlement, $basis);
|
$daysBetweenIssueAndSettlement = DateTimeExcel\YearFrac::evaluate($issue, $settlement, $basis);
|
||||||
if (!is_numeric($daysBetweenIssueAndSettlement)) {
|
if (!is_numeric($daysBetweenIssueAndSettlement)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenIssueAndSettlement;
|
return $daysBetweenIssueAndSettlement;
|
||||||
}
|
}
|
||||||
$daysBetweenIssueAndSettlement *= $daysPerYear;
|
$daysBetweenIssueAndSettlement *= $daysPerYear;
|
||||||
$daysBetweenIssueAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($issue, $maturity, $basis);
|
$daysBetweenIssueAndMaturity = DateTimeExcel\YearFrac::evaluate($issue, $maturity, $basis);
|
||||||
if (!is_numeric($daysBetweenIssueAndMaturity)) {
|
if (!is_numeric($daysBetweenIssueAndMaturity)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenIssueAndMaturity;
|
return $daysBetweenIssueAndMaturity;
|
||||||
}
|
}
|
||||||
$daysBetweenIssueAndMaturity *= $daysPerYear;
|
$daysBetweenIssueAndMaturity *= $daysPerYear;
|
||||||
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::funcYearFrac($settlement, $maturity, $basis);
|
$daysBetweenSettlementAndMaturity = DateTimeExcel\YearFrac::evaluate($settlement, $maturity, $basis);
|
||||||
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
|
||||||
// return date error
|
// return date error
|
||||||
return $daysBetweenSettlementAndMaturity;
|
return $daysBetweenSettlementAndMaturity;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class TreasuryBill
|
||||||
|
|
||||||
$daysBetweenSettlementAndMaturity = $maturity - $settlement;
|
$daysBetweenSettlementAndMaturity = $maturity - $settlement;
|
||||||
$daysPerYear = Helpers::daysPerYear(
|
$daysPerYear = Helpers::daysPerYear(
|
||||||
DateTimeExcel\Year::funcYear($maturity),
|
DateTimeExcel\Year::evaluate($maturity),
|
||||||
FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL
|
FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ class TreasuryBill
|
||||||
|
|
||||||
$daysBetweenSettlementAndMaturity = $maturity - $settlement;
|
$daysBetweenSettlementAndMaturity = $maturity - $settlement;
|
||||||
$daysPerYear = Helpers::daysPerYear(
|
$daysPerYear = Helpers::daysPerYear(
|
||||||
DateTimeExcel\Year::funcYear($maturity),
|
DateTimeExcel\Year::evaluate($maturity),
|
||||||
FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL
|
FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -134,7 +134,7 @@ class TreasuryBill
|
||||||
|
|
||||||
$daysBetweenSettlementAndMaturity = $maturity - $settlement;
|
$daysBetweenSettlementAndMaturity = $maturity - $settlement;
|
||||||
$daysPerYear = Helpers::daysPerYear(
|
$daysPerYear = Helpers::daysPerYear(
|
||||||
DateTimeExcel\Year::funcYear($maturity),
|
DateTimeExcel\Year::evaluate($maturity),
|
||||||
FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL
|
FinancialConstants::BASIS_DAYS_PER_YEAR_ACTUAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ class Format
|
||||||
$format = Functions::flattenSingleValue($format);
|
$format = Functions::flattenSingleValue($format);
|
||||||
|
|
||||||
if ((is_string($value)) && (!is_numeric($value)) && Date::isDateTimeFormatCode($format)) {
|
if ((is_string($value)) && (!is_numeric($value)) && Date::isDateTimeFormatCode($format)) {
|
||||||
$value = DateTimeExcel\DateValue::funcDateValue($value);
|
$value = DateTimeExcel\DateValue::evaluate($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (string) NumberFormat::toFormattedString($value, $format);
|
return (string) NumberFormat::toFormattedString($value, $format);
|
||||||
|
|
@ -129,14 +129,14 @@ class Format
|
||||||
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
|
||||||
|
|
||||||
if (strpos($value, ':') !== false) {
|
if (strpos($value, ':') !== false) {
|
||||||
$timeValue = DateTimeExcel\TimeValue::funcTimeValue($value);
|
$timeValue = DateTimeExcel\TimeValue::evaluate($value);
|
||||||
if ($timeValue !== Functions::VALUE()) {
|
if ($timeValue !== Functions::VALUE()) {
|
||||||
Functions::setReturnDateType($dateSetting);
|
Functions::setReturnDateType($dateSetting);
|
||||||
|
|
||||||
return $timeValue;
|
return $timeValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$dateValue = DateTimeExcel\DateValue::funcDateValue($value);
|
$dateValue = DateTimeExcel\DateValue::evaluate($value);
|
||||||
if ($dateValue !== Functions::VALUE()) {
|
if ($dateValue !== Functions::VALUE()) {
|
||||||
Functions::setReturnDateType($dateSetting);
|
Functions::setReturnDateType($dateSetting);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -437,14 +437,14 @@ class Date
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dateValueNew = DateTimeExcel\DateValue::funcDateValue($dateValue);
|
$dateValueNew = DateTimeExcel\DateValue::evaluate($dateValue);
|
||||||
|
|
||||||
if ($dateValueNew === Functions::VALUE()) {
|
if ($dateValueNew === Functions::VALUE()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($dateValue, ':') !== false) {
|
if (strpos($dateValue, ':') !== false) {
|
||||||
$timeValue = DateTimeExcel\TimeValue::funcTimeValue($dateValue);
|
$timeValue = DateTimeExcel\TimeValue::evaluate($dateValue);
|
||||||
if ($timeValue === Functions::VALUE()) {
|
if ($timeValue === Functions::VALUE()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -472,7 +472,7 @@ class AutoFilter
|
||||||
$val = $maxVal = null;
|
$val = $maxVal = null;
|
||||||
|
|
||||||
$ruleValues = [];
|
$ruleValues = [];
|
||||||
$baseDate = DateTimeExcel\Now::funcNow();
|
$baseDate = DateTimeExcel\Now::evaluate();
|
||||||
// Calculate start/end dates for the required date range based on current date
|
// Calculate start/end dates for the required date range based on current date
|
||||||
switch ($dynamicRuleType) {
|
switch ($dynamicRuleType) {
|
||||||
case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK:
|
case AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK:
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class DateTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setUnixReturn();
|
self::setUnixReturn();
|
||||||
|
|
||||||
$result = Datefunc::funcDate(2012, 1, 31); // 32-bit safe
|
$result = Datefunc::evaluate(2012, 1, 31); // 32-bit safe
|
||||||
self::assertEquals(1327968000, $result);
|
self::assertEquals(1327968000, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ class DateTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setObjectReturn();
|
self::setObjectReturn();
|
||||||
|
|
||||||
$result = Datefunc::funcDate(2012, 1, 31);
|
$result = Datefunc::evaluate(2012, 1, 31);
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
self::assertIsObject($result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
|
|
@ -50,10 +50,10 @@ class DateTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setMac1904();
|
self::setMac1904();
|
||||||
|
|
||||||
$result = Datefunc::funcDate(1918, 11, 11);
|
$result = Datefunc::evaluate(1918, 11, 11);
|
||||||
self::assertEquals($result, 5428);
|
self::assertEquals($result, 5428);
|
||||||
|
|
||||||
$result = Datefunc::funcDate(1901, 1, 31);
|
$result = Datefunc::evaluate(1901, 1, 31);
|
||||||
self::assertEquals($result, '#NUM!');
|
self::assertEquals($result, '#NUM!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class DateValueTest extends AllSetupTeardown
|
||||||
if (is_string($expectedResult)) {
|
if (is_string($expectedResult)) {
|
||||||
$replYMD = str_replace('Y', date('Y'), $expectedResult);
|
$replYMD = str_replace('Y', date('Y'), $expectedResult);
|
||||||
if ($replYMD !== $expectedResult) {
|
if ($replYMD !== $expectedResult) {
|
||||||
$expectedResult = DateValue::funcDateValue($replYMD);
|
$expectedResult = DateValue::evaluate($replYMD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->sheet->getCell("A$row")->setValue("=DATEVALUE($dateValue)");
|
$this->sheet->getCell("A$row")->setValue("=DATEVALUE($dateValue)");
|
||||||
|
|
@ -46,7 +46,7 @@ class DateValueTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setUnixReturn();
|
self::setUnixReturn();
|
||||||
|
|
||||||
$result = DateValue::funcDateValue('2012-1-31');
|
$result = DateValue::evaluate('2012-1-31');
|
||||||
self::assertEquals(1327968000, $result);
|
self::assertEquals(1327968000, $result);
|
||||||
self::assertEqualsWithDelta(1327968000, $result, 1E-8);
|
self::assertEqualsWithDelta(1327968000, $result, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +55,7 @@ class DateValueTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setObjectReturn();
|
self::setObjectReturn();
|
||||||
|
|
||||||
$result = DateValue::funcDateValue('2012-1-31');
|
$result = DateValue::evaluate('2012-1-31');
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
self::assertIsObject($result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
|
|
@ -67,9 +67,9 @@ class DateValueTest extends AllSetupTeardown
|
||||||
public function testDATEVALUEwith1904Calendar(): void
|
public function testDATEVALUEwith1904Calendar(): void
|
||||||
{
|
{
|
||||||
self::setMac1904();
|
self::setMac1904();
|
||||||
self::assertEquals(5428, DateValue::funcDateValue('1918-11-11'));
|
self::assertEquals(5428, DateValue::evaluate('1918-11-11'));
|
||||||
self::assertEquals(0, DateValue::funcDateValue('1904-01-01'));
|
self::assertEquals(0, DateValue::evaluate('1904-01-01'));
|
||||||
self::assertEquals('#VALUE!', DateValue::funcDateValue('1903-12-31'));
|
self::assertEquals('#VALUE!', DateValue::evaluate('1903-12-31'));
|
||||||
self::assertEquals('#VALUE!', DateValue::funcDateValue('1900-02-29'));
|
self::assertEquals('#VALUE!', DateValue::evaluate('1900-02-29'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,13 @@ class DaysTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
$obj1 = new DateTime('2000-3-31');
|
$obj1 = new DateTime('2000-3-31');
|
||||||
$obj2 = new DateTimeImmutable('2000-2-29');
|
$obj2 = new DateTimeImmutable('2000-2-29');
|
||||||
self::assertSame(31, Days::funcDays($obj1, $obj2));
|
self::assertSame(31, Days::evaluate($obj1, $obj2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNonDateObject(): void
|
public function testNonDateObject(): void
|
||||||
{
|
{
|
||||||
$obj1 = new Exception();
|
$obj1 = new Exception();
|
||||||
$obj2 = new DateTimeImmutable('2000-2-29');
|
$obj2 = new DateTimeImmutable('2000-2-29');
|
||||||
self::assertSame('#VALUE!', Days::funcDays($obj1, $obj2));
|
self::assertSame('#VALUE!', Days::evaluate($obj1, $obj2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class EDateTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setUnixReturn();
|
self::setUnixReturn();
|
||||||
|
|
||||||
$result = EDate::funcEDate('2012-1-26', -1);
|
$result = EDate::evaluate('2012-1-26', -1);
|
||||||
self::assertEquals(1324857600, $result);
|
self::assertEquals(1324857600, $result);
|
||||||
self::assertEqualsWithDelta(1324857600, $result, 1E-8);
|
self::assertEqualsWithDelta(1324857600, $result, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +38,7 @@ class EDateTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setObjectReturn();
|
self::setObjectReturn();
|
||||||
|
|
||||||
$result = EDate::funcEDate('2012-1-26', -1);
|
$result = EDate::evaluate('2012-1-26', -1);
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
self::assertIsObject($result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class EoMonthTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setUnixReturn();
|
self::setUnixReturn();
|
||||||
|
|
||||||
$result = EoMonth::funcEomonth('2012-1-26', -1);
|
$result = EoMonth::evaluate('2012-1-26', -1);
|
||||||
self::assertEquals(1325289600, $result);
|
self::assertEquals(1325289600, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ class EoMonthTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setObjectReturn();
|
self::setObjectReturn();
|
||||||
|
|
||||||
$result = EoMonth::funcEomonth('2012-1-26', -1);
|
$result = EoMonth::evaluate('2012-1-26', -1);
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
self::assertIsObject($result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class TimeTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setUnixReturn();
|
self::setUnixReturn();
|
||||||
|
|
||||||
$result = Time::funcTime(7, 30, 20);
|
$result = Time::evaluate(7, 30, 20);
|
||||||
self::assertEqualsWithDelta(27020, $result, 1E-8);
|
self::assertEqualsWithDelta(27020, $result, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ class TimeTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setObjectReturn();
|
self::setObjectReturn();
|
||||||
|
|
||||||
$result = Time::funcTime(7, 30, 20);
|
$result = Time::evaluate(7, 30, 20);
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
self::assertIsObject($result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
|
|
@ -51,13 +51,13 @@ class TimeTest extends AllSetupTeardown
|
||||||
public function testTIME1904(): void
|
public function testTIME1904(): void
|
||||||
{
|
{
|
||||||
self::setMac1904();
|
self::setMac1904();
|
||||||
$result = Time::funcTime(0, 0, 0);
|
$result = Time::evaluate(0, 0, 0);
|
||||||
self::assertEquals(0, $result);
|
self::assertEquals(0, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTIME1900(): void
|
public function testTIME1900(): void
|
||||||
{
|
{
|
||||||
$result = Time::funcTime(0, 0, 0);
|
$result = Time::evaluate(0, 0, 0);
|
||||||
self::assertEquals(0, $result);
|
self::assertEquals(0, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class TimeValueTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setUnixReturn();
|
self::setUnixReturn();
|
||||||
|
|
||||||
$result = TimeValue::funcTimeValue('7:30:20');
|
$result = TimeValue::evaluate('7:30:20');
|
||||||
self::assertEquals(23420, $result);
|
self::assertEquals(23420, $result);
|
||||||
self::assertEqualsWithDelta(23420, $result, 1E-8);
|
self::assertEqualsWithDelta(23420, $result, 1E-8);
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +40,7 @@ class TimeValueTest extends AllSetupTeardown
|
||||||
{
|
{
|
||||||
self::setObjectReturn();
|
self::setObjectReturn();
|
||||||
|
|
||||||
$result = TimeValue::funcTimeValue('7:30:20');
|
$result = TimeValue::evaluate('7:30:20');
|
||||||
// Must return an object...
|
// Must return an object...
|
||||||
self::assertIsObject($result);
|
self::assertIsObject($result);
|
||||||
// ... of the correct type
|
// ... of the correct type
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ class WeekDayTest extends AllSetupTeardown
|
||||||
public function testWEEKDAYwith1904Calendar(): void
|
public function testWEEKDAYwith1904Calendar(): void
|
||||||
{
|
{
|
||||||
self::setMac1904();
|
self::setMac1904();
|
||||||
self::assertEquals(7, WeekDay::funcWeekDay('1904-01-02'));
|
self::assertEquals(7, WeekDay::evaluate('1904-01-02'));
|
||||||
self::assertEquals(6, WeekDay::funcWeekDay('1904-01-01'));
|
self::assertEquals(6, WeekDay::evaluate('1904-01-01'));
|
||||||
self::assertEquals(6, WeekDay::funcWeekDay(null));
|
self::assertEquals(6, WeekDay::evaluate(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue