dev: gantt chart revamp (#1900)

* style: gantt chart polishing

* chore: sidebar y-axis drag and drop

* chore: remove y-axis drag and drop from the main content

* refactor: drop end function

* refactor: resizing logic

* chore: x-axis block move

* chore: x-axis block move flag

* chore: update scroll end logic

* style: modules gantt chart

* style: block background tint

* refactor: context dispatcher types

* refactor: draggable component

* chore: filters added to gantt chart

* refactor: folder structure

* style: cycle blocks

* chore: move to block arrow

* chore: move to block on the right side arrow

* chore: added proper comments for functions

* refactor: blocks render logic

* fix: x-axis drag and drop

* chore: minor ui fixes

* chore: remove link tag from blocks

---------

Co-authored-by: Aaryan Khandelwal <aaryan610@Aaryans-MacBook-Pro.local>
This commit is contained in:
Aaryan Khandelwal 2023-08-28 13:25:47 +05:30 committed by GitHub
parent a61e8370b5
commit 47abe9db5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 965 additions and 635 deletions

View file

@ -374,3 +374,32 @@ export const getAllTimeIn30MinutesInterval = (): Array<{
{ label: "11:00", value: "11:00" },
{ label: "11:30", value: "11:30" },
];
/**
* @returns {number} total number of days in range
* @description Returns total number of days in range
* @param {string} startDate
* @param {string} endDate
* @param {boolean} inclusive
* @example checkIfStringIsDate("2021-01-01", "2021-01-08") // 8
*/
export const findTotalDaysInRange = (
startDate: Date | string,
endDate: Date | string,
inclusive: boolean
): number => {
if (!startDate || !endDate) return 0;
startDate = new Date(startDate);
endDate = new Date(endDate);
// find number of days between startDate and endDate
const diffInTime = endDate.getTime() - startDate.getTime();
const diffInDays = diffInTime / (1000 * 3600 * 24);
// if inclusive is true, add 1 to diffInDays
if (inclusive) return diffInDays + 1;
return diffInDays;
};