From cd978c05b313ceb773e01afa774dae2410e1c01c Mon Sep 17 00:00:00 2001 From: Andrei Duvakin Date: Tue, 28 Jan 2025 18:57:30 +0500 Subject: [PATCH] ._. --- WEB/app/src/app/app.css | 6 ++++++ WEB/app/src/app/components/сalendar.js | 24 +++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/WEB/app/src/app/app.css b/WEB/app/src/app/app.css index 94723b5..f9d3c74 100644 --- a/WEB/app/src/app/app.css +++ b/WEB/app/src/app/app.css @@ -184,3 +184,9 @@ .calendar-day:hover { background-color: #cfcfcf; } +.current-day { + border: 1px solid #2f9836; + border-radius: 50%; + font-weight: bold; + color: black; +} diff --git a/WEB/app/src/app/components/сalendar.js b/WEB/app/src/app/components/сalendar.js index b12abea..a74cdb3 100644 --- a/WEB/app/src/app/components/сalendar.js +++ b/WEB/app/src/app/components/сalendar.js @@ -1,9 +1,10 @@ 'use client'; -import {useState} from "react"; +import { useState } from "react"; const Calendar = () => { const [currentDate, setCurrentDate] = useState(new Date()); + const today = new Date(); // Текущая дата (для сравнения) const year = currentDate.getFullYear(); const month = currentDate.getMonth(); @@ -16,8 +17,7 @@ const Calendar = () => { const daysInMonth = new Date(year, month + 1, 0).getDate(); // Количество дней в месяце const startOffset = firstDayOfMonth === 0 ? 6 : firstDayOfMonth - 1; - - const daysArray = Array.from({length: daysInMonth}, (_, i) => i + 1); + const daysArray = Array.from({ length: daysInMonth }, (_, i) => i + 1); return [...Array(startOffset).fill(null), ...daysArray]; }; @@ -28,7 +28,7 @@ const Calendar = () => {
-

{currentDate.toLocaleString("ru-RU", {month: "long", year: "numeric"})}

+

{currentDate.toLocaleString("ru-RU", { month: "long", year: "numeric" })}

@@ -37,8 +37,22 @@ const Calendar = () => {
{day}
))} {days.map((day, index) => - day ?
{day}
: + day ? ( +
+ {day} +
+ ) : (
+ ) )}