diff --git a/Documentation/FunctionListByCategory.txt b/Documentation/FunctionListByCategory.txt index b23d9a11..7ac726d3 100644 --- a/Documentation/FunctionListByCategory.txt +++ b/Documentation/FunctionListByCategory.txt @@ -39,7 +39,7 @@ CATEGORY_DATE_AND_TIME TIMEVALUE PHPExcel_Calculation_DateTime::TIMEVALUE TODAY PHPExcel_Calculation_DateTime::DATENOW WEEKDAY PHPExcel_Calculation_DateTime::DAYOFWEEK - WEEKNUM PHPExcel_Calculation_DateTime::WEEKOFYEAR + WEEKNUM PHPExcel_Calculation_DateTime::WEEKNUM WORKDAY PHPExcel_Calculation_DateTime::WORKDAY YEAR PHPExcel_Calculation_DateTime::YEAR YEARFRAC PHPExcel_Calculation_DateTime::YEARFRAC diff --git a/Documentation/FunctionListByName.txt b/Documentation/FunctionListByName.txt index 45a9daf7..2305f213 100644 --- a/Documentation/FunctionListByName.txt +++ b/Documentation/FunctionListByName.txt @@ -365,7 +365,7 @@ VERSION CATEGORY_INFORMATION PHPExcel_Calculation_Fun VLOOKUP CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::VLOOKUP WEEKDAY CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::DAYOFWEEK -WEEKNUM CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::WEEKOFYEAR +WEEKNUM CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::WEEKNUM WEIBULL CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::WEIBULL WORKDAY CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::WORKDAY diff --git a/Documentation/markdown/Functions/FunctionListByCategory.md b/Documentation/markdown/Functions/FunctionListByCategory.md index 4ceb1e47..62c46f64 100644 --- a/Documentation/markdown/Functions/FunctionListByCategory.md +++ b/Documentation/markdown/Functions/FunctionListByCategory.md @@ -48,7 +48,7 @@ TIMEVALUE | PHPExcel_Calculation_DateTime::TIMEVALUE TODAY | PHPExcel_Calculation_DateTime::DATENOW WEEKDAY | PHPExcel_Calculation_DateTime::DAYOFWEEK - WEEKNUM | PHPExcel_Calculation_DateTime::WEEKOFYEAR + WEEKNUM | PHPExcel_Calculation_DateTime::WEEKNUM WORKDAY | PHPExcel_Calculation_DateTime::WORKDAY YEAR | PHPExcel_Calculation_DateTime::YEAR YEARFRAC | PHPExcel_Calculation_DateTime::YEARFRAC diff --git a/Documentation/markdown/Functions/FunctionListByName.md b/Documentation/markdown/Functions/FunctionListByName.md index b69e4546..addae289 100644 --- a/Documentation/markdown/Functions/FunctionListByName.md +++ b/Documentation/markdown/Functions/FunctionListByName.md @@ -457,7 +457,7 @@ Excel Function | Category | PHPExcel Function --------------------|--------------------------------|------------------------------------------- WEEKDAY | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::DAYOFWEEK - WEEKNUM | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::WEEKOFYEAR + WEEKNUM | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::WEEKNUM WEIBULL | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::WEIBULL WORKDAY | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::WORKDAY diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index c60ce0c5..bd643dea 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -1965,7 +1965,7 @@ class Calculation ], 'WEEKNUM' => [ 'category' => Calculation\Categories::CATEGORY_DATE_AND_TIME, - 'functionCall' => '\\PhpOffice\\PhpSpreadsheet\\Calculation\\DateTime::WEEKOFYEAR', + 'functionCall' => '\\PhpOffice\\PhpSpreadsheet\\Calculation\\DateTime::WEEKNUM', 'argumentCount' => '1,2', ], 'WEIBULL' => [ diff --git a/src/PhpSpreadsheet/Calculation/DateTime.php b/src/PhpSpreadsheet/Calculation/DateTime.php index 9f7d32f3..548e1f1d 100644 --- a/src/PhpSpreadsheet/Calculation/DateTime.php +++ b/src/PhpSpreadsheet/Calculation/DateTime.php @@ -1199,7 +1199,7 @@ class DateTime } /** - * WEEKOFYEAR + * WEEKNUM * * Returns the week of the year for a specified date. * The WEEKNUM function considers the week containing January 1 to be the first week of the year. @@ -1218,7 +1218,7 @@ class DateTime * 2 Week begins on Monday. * @return int Week Number */ - public static function WEEKOFYEAR($dateValue = 1, $method = 1) + public static function WEEKNUM($dateValue = 1, $method = 1) { $dateValue = Functions::flattenSingleValue($dateValue); $method = Functions::flattenSingleValue($method); diff --git a/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php b/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php index d33a74ae..12c621f4 100644 --- a/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/DateTimeTest.php @@ -145,7 +145,7 @@ class DateTimeTest extends \PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array([DateTime::class, 'WEEKOFYEAR'], $args); + $result = call_user_func_array([DateTime::class, 'WEEKNUM'], $args); $this->assertEquals($expectedResult, $result, null, 1E-8); }