Error with no english dates on the remote website

Created on 25 March 2025, 25 days ago

Problem/Motivation

Error with no english dates on the remote website

Steps to reproduce

When the remote website is refreshed in the dashboerd and has non-English date format as default. The SGD dasboard gets a fatal error (WSOD).

Proposed resolution

on line 554 of file sgd_dashboard/src/Plugin/SgdCompanion/SgdCompanionSgdCore.php
replace code with:


case 'cron_last_run':

  $lastRunString = substr($status['value'], strlen('Last run '));

  try {
    $lastRun = new \DateTime($lastRunString);
    $threshold = new \DateTime('1 day ago');

    if ($lastRun < $threshold) {
      $validation[$key] = [
        'class' => 'error',
        'text' => $this->t('Issue'),
        'message' => $this->t('CRON has not run for more than a day.'),
      ];
    }
    else {
      $validation[$key] = [
        'class' => 'ok',
        'text' => $this->t('OK'),
      ];
    }
  }
  catch (\Exception $e) {
    // if parsing fails, show message
    $validation[$key] = [
      'class' => 'warning',
      'text' => $this->t('Unknown'),
      'message' => $this->t('Unable to parse CRON run time: @string', ['@string' => $lastRunString]),
    ];
  }

  break;

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇧🇪Belgium yazzbe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024