yearMonth split into year + month

This commit is contained in:
2024-01-09 15:43:01 +01:00
parent 90edcf14e1
commit 46b65711a8
12 changed files with 73 additions and 88 deletions

View File

@@ -11,7 +11,7 @@ export interface LocationCardProps {
location: BillingLocation
}
export const LocationCard:FC<LocationCardProps> = ({location: { _id, name, yearMonth, bills }}) => {
export const LocationCard:FC<LocationCardProps> = ({location: { _id, name, year, month, bills }}) => {
// sum all the billAmounts
const monthlyExpense = bills.reduce((acc, bill) => acc + (bill.payedAmount ?? 0), 0);
@@ -22,7 +22,7 @@ export const LocationCard:FC<LocationCardProps> = ({location: { _id, name, yearM
<a href={`/location/${_id}/edit`} className="card-subtitle tooltip" data-tip="Edit Location">
<Cog8ToothIcon className="h-[1em] w-[1em] absolute cursor-pointer top-3 right-3 text-2xl" />
</a>
<h2 className="card-title">{formatYearMonth(yearMonth)} {name}</h2>
<h2 className="card-title">{formatYearMonth(year, month)} {name}</h2>
<div className="card-actions">
{
bills.map(bill => <BillBadge key={`${bill._id}`} locationId={_id} bill={bill} />)