add month name to monthlytable

This commit is contained in:
Romulus21
2024-03-11 09:10:02 +01:00
parent dc9351dd9a
commit 2f260555cb
2 changed files with 2 additions and 2 deletions

View File

@@ -138,7 +138,7 @@ class RainfallController extends Controller
$result[$month][] = [ $result[$month][] = [
'year' => $date->year, 'year' => $date->year,
'month' => $date->month, 'month' => $date->month,
'label' => $date->monthName.' '.$date->year, 'label' => $date->monthName,
'values' => (int) $rainfalls, 'values' => (int) $rainfalls,
]; ];
} }

View File

@@ -49,7 +49,7 @@ const YearRainfall = () => {
{Object.entries(data) {Object.entries(data)
.map(([month, months]) => { .map(([month, months]) => {
return <tr key={month}> return <tr key={month}>
<td>{month}</td> <td>{months[0].label}</td>
<td>{months.find(m => m.year === (new Date).getFullYear() && m.month === Number(month))?.values}</td> <td>{months.find(m => m.year === (new Date).getFullYear() && m.month === Number(month))?.values}</td>
<td>{months.find(m => m.year === ((new Date).getFullYear() - 1) && m.month === Number(month))?.values}</td> <td>{months.find(m => m.year === ((new Date).getFullYear() - 1) && m.month === Number(month))?.values}</td>
</tr> </tr>