diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 0c2e3f12160..12bc0fc9d94 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This file is a modified version of datepicker.php from phpBSM to fix some @@ -233,7 +233,8 @@ function displayBox($selectedDate, $month, $year) //print "x ".$thedate." y"; // $thedate = first day of month $firstdate = dol_getdate($thedate); //var_dump($firstdateofweek); - $mydate = dol_get_first_day_week(1, $month, $year, true); // mydate = cursor date + $mydate_tmp = dol_get_first_day_week(1, $month, $year, true); // mydate = cursor date + $mydate = dol_getdate(dol_mktime(12, 0, 0, $mydate_tmp['first_month'], $mydate_tmp['first_day'], $mydate_tmp['first_year'])); // Loop on each day of month $stoploop = 0; @@ -241,7 +242,7 @@ function displayBox($selectedDate, $month, $year) $cols = 0; while (!$stoploop) { //print_r($mydate); - if ($mydate < $firstdate) { // At first run + if ($mydate[0] < $firstdate[0]) { // At first run echo ""; //echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday; $cols = 0; @@ -291,7 +292,7 @@ function displayBox($selectedDate, $month, $year) $stoploop = 1; } else { $mydate = dol_getdate($thedate); - if ($firstdate["month"] != $mydate["month"]) { + if ($firstdate["mon"] != $mydate["mon"]) { $stoploop = 1; } }