Skip to content

Commit

Permalink
✨ Use local timezone date for SCP page
Browse files Browse the repository at this point in the history
closes #1062
  • Loading branch information
akrherz committed Jan 9, 2025
1 parent 75a6dad commit 36600b3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions htdocs/sites/scp.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@

$exturi = sprintf(
"https://mesonet.agron.iastate.edu/" .
"api/1/scp.json?station=%s&date=%s",
"api/1/scp.json?station=%s&date=%s&tz=%s",
$station,
date("Y-m-d", $date)
date("Y-m-d", $date),
$metadata["tzname"],
);
$arr = array(
"station" => $station,
"date" => date("Y-m-d", $date),
"tz" => $metadata["tzname"],
);
$json = iemws_json("scp.json", $arr);
if ($json === FALSE) {
Expand Down Expand Up @@ -88,8 +90,11 @@ function skyc($row, $i)

$table = <<<EOM
<table>
<thead>
<tr><th rowspan="2" class="rl">SCP Valid UTC</th>$header<th colspan="2">ASOS METAR Report</th></tr>
<thead class="sticky">
<tr>
<th rowspan="2" class="rl">SCP Valid UTC</th>
<th rowspan="2" class="rl">METAR Valid Local</th>
$header<th colspan="2">ASOS METAR Report</th></tr>
<tr>$header2<th>Levels ft</th><th>METAR</th></tr>
</thead>
<tbody>
Expand All @@ -103,8 +108,9 @@ function skyc($row, $i)
continue;
}
$table .= sprintf(
"<tr><td class=\"rl\">%sZ</td>",
gmdate("Hi", strtotime($row["utc_scp_valid"]))
"<tr><td class=\"rl\">%sZ</td><td class=\"rl\">%s</td>",
gmdate("Hi", strtotime($row["utc_scp_valid"])),
date("g:i A", strtotime($row["local_valid"]))
);
foreach ($birds as $b) {
$table .= sprintf(
Expand Down

0 comments on commit 36600b3

Please sign in to comment.