Update date.lib.php

This commit is contained in:
javieralapps4up 2021-10-20 00:36:24 +02:00 committed by GitHub
parent 11723c2cd0
commit 2ca0a1facf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,7 +117,7 @@ function getServerTimeZoneInt($refgmtdate = 'now')
* @param int $duration_unit Unit of added delay (d, m, y, w, h, i)
* @return int New timestamp
*/
function dol_time_plus_duree($time, $duration_value, $duration_unit)
function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth = 0)
{
global $conf;
@ -167,7 +167,7 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit)
$date->add($interval);
}
//Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (php returns March 1, 2 or 3 respectively)
if ($conf->global->MAIN_DATE_CHANGE_PHP_DATEINTERVAL_RESULT_FEBRUARY && $duration_unit == 'm') {
if ($ruleforendofmonth == 1 && $duration_unit == 'm') {
$timeyear = dol_print_date($time, '%Y');
$timemonth = dol_print_date($time, '%m');
$timetotalmonths = (($timeyear * 12) + $timemonth);