[WEB-761] fix: Time zone date misalignment (#3986)

* fix date time misalignment

* fix failing build

* fix gantt chart view position fix

* comments for getDate method

* remove new Date() where not required

* changes from my self review
This commit is contained in:
rahulramesha 2024-03-19 17:40:20 +05:30 committed by GitHub
parent aa3702cd46
commit 1a462711e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 303 additions and 192 deletions

View file

@ -1,6 +1,7 @@
import { v4 as uuidv4 } from "uuid";
import differenceInCalendarDays from "date-fns/differenceInCalendarDays";
// helpers
import { getDate } from "./date-time.helper";
import { orderArrayBy } from "helpers/array.helper";
// types
import {
@ -157,7 +158,9 @@ export const shouldHighlightIssueDueDate = (
// if the issue is completed or cancelled, don't highlight the due date
if ([STATE_GROUPS.completed.key, STATE_GROUPS.cancelled.key].includes(stateGroup)) return false;
const parsedDate = new Date(date);
const parsedDate = getDate(date);
if (!parsedDate) return false;
const targetDateDistance = differenceInCalendarDays(parsedDate, new Date());
// if the issue is overdue, highlight the due date
@ -168,6 +171,6 @@ export const renderIssueBlocksStructure = (blocks: TIssue[]): IGanttBlock[] =>
data: block,
id: block.id,
sort_order: block.sort_order,
start_date: block.start_date ? new Date(block.start_date) : null,
target_date: block.target_date ? new Date(block.target_date) : null,
start_date: getDate(block.start_date),
target_date: getDate(block.target_date),
}));