Make formatting a bit more better

Display dates for months in view
This commit is contained in:
2024-08-19 12:33:26 +02:00
parent 8c10540309
commit c5613ee0cc
5 changed files with 35 additions and 17 deletions

View File

@@ -1,12 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta charset="UTF-8" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>wails-template</title>
</head>
<body>
<div id="app"></div>
<script src="./src/main.ts" type="module"></script>
<div id="app"></div>
<script src="./src/main.ts" type="module"></script>
</body>
</html>

View File

@@ -17,7 +17,7 @@
<svelte:window on:keydown={keyDown} />
<Toaster theme="dark" expand visibleToasts={9} />
<template>
<Header />
<!-- <Header /> -->
<main class="flex-1">
<Router />
</main>

View File

@@ -11,7 +11,5 @@
</script>
<template>
<div>
<p>{paymentBill.name}</p>
</div>
</template>

View File

@@ -6,6 +6,12 @@
import PaymentBillComp from "./PaymentBillComp.svelte";
export let payments: main.Payment[] = [];
export let date: Date = new Date();
let dateString: string = date.toISOString()
$: {
dateString = date.toISOString().split("T")[0]
dateString = dateString.split("-").slice(0, 2).join("-");
}
const paymentsModel: { [key: number]: PaymentBill } = {};
for (const bill of $billsStore) {
@@ -30,9 +36,14 @@
</script>
<template>
<div class="border-double border-2 border-gray-500 m-1">
<div class="text-4xl font-bold">
{dateString}
</div>
<div>
{#each Object.values(paymentsModel) as payment}
<PaymentBillComp paymentBill={payment} />
{/each}
</div>
</div>
</template>

View File

@@ -1,12 +1,18 @@
<script lang="ts">
import Payments from "$lib/components/Payments.svelte";
import { nowStore } from "$lib/store/nowStore";
import { lastMonthPaymentsStore } from "$lib/store/lastMonthPaymentsStore";
import { thisMonthPaymentsStore } from "$lib/store/thisMonthPaymentsStore";
const thisMonth = new Date();
thisMonth.setMonth($nowStore.getMonth());
const previousMonth = new Date();
previousMonth.setMonth($nowStore.getMonth() - 1);
</script>
<template>
<Payments payments={$thisMonthPaymentsStore} />
<Payments payments={$lastMonthPaymentsStore} />
<div class="grid grid-cols-2">
<Payments date={previousMonth} payments={$lastMonthPaymentsStore} />
<Payments date={thisMonth} payments={$thisMonthPaymentsStore} />
</div>
</template>