Improved Calender Side Bar jump Feature
Wenn man jetzt in der Kalender-Sidebar auf einen Monat klickt, dann springt er nicht mehr immer zum Ersten des Monats.
This commit is contained in:
@@ -536,7 +536,16 @@ export default function CalenderView(p) {
|
|||||||
|
|
||||||
function onMonthClick(monthIndex, startParts) {
|
function onMonthClick(monthIndex, startParts) {
|
||||||
monthIndex--
|
monthIndex--
|
||||||
let date = new Date(parseInt(startParts[2]), monthIndex, 1)
|
let startDay = 1
|
||||||
|
let date = new Date(parseInt(startParts[2]), monthIndex, startDay);
|
||||||
|
if(monthIndex + 1 == startParts[1] && startParts[0] != 1){
|
||||||
|
startDay = startParts[0];
|
||||||
|
date = new Date(parseInt(startParts[2]), monthIndex, startDay);
|
||||||
|
}
|
||||||
|
if(date.getDay() == 0){
|
||||||
|
startDay = parseInt(startDay.toString()) + 1
|
||||||
|
date = new Date(parseInt(startParts[2]), monthIndex, startDay);
|
||||||
|
}
|
||||||
let start = new Date(date.getFullYear(), 0, 0)
|
let start = new Date(date.getFullYear(), 0, 0)
|
||||||
currentWeekStartDay = Math.round((date - start) / (1000 * 60 * 60 * 24))
|
currentWeekStartDay = Math.round((date - start) / (1000 * 60 * 60 * 24))
|
||||||
currentWeekStartDay = currentWeekStartDay - new Date(date.getFullYear(), 0, currentWeekStartDay).getUTCDay()
|
currentWeekStartDay = currentWeekStartDay - new Date(date.getFullYear(), 0, currentWeekStartDay).getUTCDay()
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import Button from "@/components/Button";
|
|||||||
import DateElement from "@/components/DateElement";
|
import DateElement from "@/components/DateElement";
|
||||||
import { arrowLeft } from "./Icons"
|
import { arrowLeft } from "./Icons"
|
||||||
import { arrowRight } from "./Icons"
|
import { arrowRight } from "./Icons"
|
||||||
import { useState } from 'react'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user