Highlight Added

Bugs
This commit is contained in:
AliGitGut
2023-06-08 23:58:12 +02:00
parent dc5815d73d
commit 2be842abea
4 changed files with 27044 additions and 2 deletions
+17 -1
View File
@@ -11,6 +11,17 @@ const weekdays = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"]
export default function BasicDateCalendar(p) {
function getBackMonthColor(monthIndex)
{
let date = new Date(parseInt(startParts[2]), parseInt(startParts[1]) + monthIndex, 1)
console.log(p.highlightYear + " " + date.getFullYear())
if (date.getFullYear() === p.highlightYear && date.getMonth() === p.highlightMonth + 1)
{
return true
}else
return false
}
useEffect(() => {
startParts = []
endParts = []
@@ -36,7 +47,10 @@ export default function BasicDateCalendar(p) {
textAlign : "center",
marginBottom : 10,
fontSize: 19,
pointerEvents: "none"
pointerEvents: "none",
backgroundColor: getBackMonthColor(index) ? "#346991":"rgba(0,0,0,0)",
color : getBackMonthColor(index) ? "white":"black",
borderRadius : 10
}}>{getMonthName(index)}</p>
<div className={"Days"} style={{
pointerEvents: "none"
@@ -60,6 +74,8 @@ export default function BasicDateCalendar(p) {
)
}
function getMonthName(monthIndex) {
if (startParts[1] - 1 + monthIndex < 12) {
return months[startParts[1] - 1 + monthIndex][0];