Proyectos de Subversion LeadersLinked - Services

Rev

Rev 379 | Rev 382 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 379 Rev 381
Línea 47... Línea 47...
47
     *
47
     *
48
     * @param string|null $initialDate Fecha inicial en formato `YYYY-MM-DD` o `null`.
48
     * @param string|null $initialDate Fecha inicial en formato `YYYY-MM-DD` o `null`.
49
     * @param string|null $finalDate Fecha final en formato `YYYY-MM-DD` o `null`.
49
     * @param string|null $finalDate Fecha final en formato `YYYY-MM-DD` o `null`.
50
     * @return array Arreglo con las fechas validadas [initialDate, finalDate].
50
     * @return array Arreglo con las fechas validadas [initialDate, finalDate].
51
     */
51
     */
52
    function validateAndAdjustDates($initialDate, $finalDate)
52
    function validateAndAdjustDates($filter, $initialDate, $finalDate)
53
    {
53
    {
54
        $currentDate = date('Y-m-d'); // Fecha actual en formato YYYY-MM-DD
54
        $currentDate = date('Y-m-d'); // Fecha actual en formato YYYY-MM-DD
55
        $yesterdayDate = date('Y-m-d', strtotime('-1 day')); // Fecha del día anterior
55
        $yesterdayDate = date('Y-m-d', strtotime('-1 day')); // Fecha del día anterior
Línea 56... Línea 56...
56
 
56
 
Línea 74... Línea 74...
74
        }
74
        }
Línea 75... Línea 75...
75
 
75
 
76
        return [$initialDate, $finalDate];
76
        return [$initialDate, $finalDate];
Línea -... Línea 77...
-
 
77
    }
-
 
78
 
-
 
79
    /**
-
 
80
     * Generates a list of dates within a given range and marks whether they exist in a provided list.
-
 
81
     *
-
 
82
     * @param array $datesList An array of dates to check against.
-
 
83
     * @param string $startDate The start date of the range (YYYY-MM-DD).
-
 
84
     * @param string $endDate The end date of the range (YYYY-MM-DD).
-
 
85
     * @return array A list of dictionaries with each date and a flag indicating its presence in the given list.
-
 
86
     */
-
 
87
    function generateDateList($datesList, $startDate, $endDate)
-
 
88
    {
-
 
89
        $result = [];
-
 
90
        $start = new DateTime($startDate);
-
 
91
        $end = new DateTime($endDate);
-
 
92
        $datesLookup = array_flip($datesList); // Convert list to keys for quick lookup
-
 
93
 
-
 
94
        while ($start <= $end) {
-
 
95
            $dateStr = $start->format('Y-m-d');
-
 
96
            $result[] = [
-
 
97
                'date' => $dateStr,
-
 
98
                'flag' => isset($datesLookup[$dateStr])
-
 
99
            ];
-
 
100
            $start->modify('+1 day');
-
 
101
        }
-
 
102
 
-
 
103
        return $result;
Línea 77... Línea 104...
77
    }
104
    }
78
 
105
 
79
 
106
 
80
    /**
107
    /**