Commit 572b2feb authored by Ermolaev Timur's avatar Ermolaev Timur

#132 Исправил баг со временем для колонки дня недели

parent 5bca45a0
...@@ -11,7 +11,7 @@ import { getTasksWithInfoForPosition, getWidthLeftZIndex } from "./Helpers"; ...@@ -11,7 +11,7 @@ import { getTasksWithInfoForPosition, getWidthLeftZIndex } from "./Helpers";
function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat, handleOpen, setCurrentTask, copyTask, setCopyTask, createCopyTask, createTaskInCellHandler, modal, dragTaskHandler }) { function CalendarColumnDayWeek({ hoursInDay, tasks, month, year, day, hourFormat, handleOpen, setCurrentTask, copyTask, setCopyTask, createCopyTask, createTaskInCellHandler, modal, dragTaskHandler }) {
const [columnDaySize, setColumnDaySize] = useState({ width: 0, height: 0 }) const [columnDaySize, setColumnDaySize] = useState({ width: 0, height: 0 })
console.log(month, year)
const dayColumnRef = useRef('') const dayColumnRef = useRef('')
useEffect(() => { useEffect(() => {
setColumnDaySize(prev => { return { height: dayColumnRef.current.offsetHeight, width: dayColumnRef.current.offsetWidth } }) setColumnDaySize(prev => { return { height: dayColumnRef.current.offsetHeight, width: dayColumnRef.current.offsetWidth } })
......
...@@ -10,12 +10,12 @@ export const getCurrentWeekDayString = (dayNumber) => { ...@@ -10,12 +10,12 @@ export const getCurrentWeekDayString = (dayNumber) => {
export const getMonthAndYearToDayColumn = (week, weekDay, month, year) => { export const getMonthAndYearToDayColumn = (week, weekDay, month, year) => {
if (week[0] > week[6]) { if (week[0] > week[6]) {
if (weekDay < week[0]) { if (weekDay < week[0]) {
return {month: month, year: year} if (month + 1 === 12) {
} else { return {month: 0, year: year + 1}
if (month === 0) {
return {month: 11, year: year - 1}
} }
return {month: month - 1, year: year} return {month: month + 1, year: year}
} else {
return {month: month, year: year}
} }
} else { } else {
return {month: month, year: year} return {month: month, year: year}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment