Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Substitute deprecated strftime() function with date() #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Classes/Utility/PageSpeedInsightsUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public static function getLastRun($pageId = 0, $strategy = ''): string
* @param string $labelFormat
* @return array
*/
public static function getChartData($daysInPastToStartFrom, $daysPerStep, $pageId = 0, $strategy = '', $chartColor1 = '', $chartColor2 = '', $chartColor3 = '', $chartColor4 = '', $chartColor5 = '', $labelFormat = '%d-%m-%Y'): array
public static function getChartData($daysInPastToStartFrom, $daysPerStep, $pageId = 0, $strategy = '', $chartColor1 = '', $chartColor2 = '', $chartColor3 = '', $chartColor4 = '', $chartColor5 = '', $labelFormat = 'd-m-Y'): array
{
$labels = [];
$dataPerformance = [];
Expand All @@ -213,7 +213,7 @@ public static function getChartData($daysInPastToStartFrom, $daysPerStep, $pageI
$dataPwa = [];

for ($daysBefore = $daysInPastToStartFrom; $daysBefore >= 0; $daysBefore-=$daysPerStep) {
$labels[] = strftime($labelFormat, strtotime('-' . $daysBefore . ' day'));
$labels[] = date($labelFormat, strtotime('-' . $daysBefore . ' day'));
$startPeriod = strtotime('-' . $daysBefore . ' day 0:00:00');
$endPeriod = strtotime('-' . ($daysBefore - $daysPerStep + 1) . ' day 23:59:59');

Expand Down