Skip to content
Snippets Groups Projects
Commit 53df8a9b authored by Allan Chappell's avatar Allan Chappell Committed by Allan Chappell
Browse files

Issue #3335387 by generalredneck, Christos Diamantis, GiorgosK: Function...

Issue #3335387 by generalredneck, Christos Diamantis, GiorgosK: Function gmstrftime() is deprecated in Drupal\openweather\WeatherService->getHourlyForecastWeatherInformation()
parent 2b9bb2ac
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ use GuzzleHttp\ClientInterface;
use Drupal\Component\Utility\Html;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\ConnectException;
use Drupal\Component\Datetime\DateTimePlus;
/**
* Service to manage conection to openweathermap.
......@@ -283,7 +284,8 @@ class WeatherService {
foreach ($output['list'] as $key => $data) {
$html[$key]['forecast_time'] = date("g:i a", strtotime($output['list'][$key]['dt_txt']));
$html[$key]['forecast_date'] = gmstrftime("%B %d", $output['list'][$key]['dt']);
$time = DateTimePlus::createFromTimestamp($output['list'][$key]['dt'], 'UTC');
$html[$key]['forecast_date'] = $time->format("F d");
foreach ($config['outputitems'] as $value) {
if (!empty($config['outputitems'][$value])) {
switch ($config['outputitems'][$value]) {
......@@ -346,7 +348,7 @@ class WeatherService {
break;
case 'day':
$html[$key][$value] = gmstrftime("%A", $output['list'][$key]['dt']);
$html[$key][$value] = $time->format('l');
break;
case 'country':
......@@ -382,7 +384,8 @@ class WeatherService {
}
foreach ($output['list'] as $key => $data) {
$html[$key]['forecast_date'] = gmstrftime("%B %d", $output['list'][$key]['dt']);
$time = DateTimePlus::createFromTimestamp($output['list'][$key]['dt'], 'UTC');
$html[$key]['forecast_date'] = $time->format("F d");
foreach ($config['outputitems'] as $value) {
if (!empty($config['outputitems'][$value])) {
switch ($config['outputitems'][$value]) {
......@@ -445,7 +448,7 @@ class WeatherService {
break;
case 'day':
$html[$key][$value] = gmstrftime("%A", $output['list'][$key]['dt']);
$html[$key][$value] = $time->format('l');
break;
case 'country':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment