JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Monthly Interest Calculator</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        .container {
            max-width: 600px;
            margin: auto;
            padding: 20px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        input, button {
            margin: 10px 0;
            padding: 10px;
            width: 100%;
            box-sizing: border-box;
        }
        button {
            background-color: #4CAF50;
            color: white;
            border: none;
            cursor: pointer;
        }
        button:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>Monthly Interest Calculator</h2>
        <form id="interestForm">
            <label for="balanceBeforeChange">Balance Before Change (€):</label>
            <input type="number" id="balanceBeforeChange" name="balanceBeforeChange" required value="10000">

            <label for="balanceAfterChange">Balance After Change (€):</label>
            <input type="number" id="balanceAfterChange" name="balanceAfterChange" required value="11000">

            <label for="changeDate">Change Date:</label>
            <input type="date" id="changeDate" name="changeDate" required>

            <label for="annualInterestRate">Annual Interest Rate (%):</label>
            <input type="number" id="annualInterestRate" name="annualInterestRate" step="0.01" required value="4">

            <button type="button" onclick="calculateInterest()">Calculate Interest</button>
        </form>
        <h3 id="result"></h3>
    </div>

    <script>
		function getDaysInMonth(year, month) {
			return new Date(year, month, 0).getDate();
		}

		function getMonthName(date) {
			const monthNames =...