[WEB-782] fix: Date timezone changes error (#3992)

* fix date related exceptions

* replace new Date from develop branch changes as well

* changes from self review

* wrap getDate logic with try catch to handle in case of error scenarios

* fix formatted time
This commit is contained in:
rahulramesha 2024-03-20 13:44:08 +05:30 committed by GitHub
parent 7d3a96b3d0
commit cb4cfa1dd5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 127 additions and 83 deletions

View file

@ -155,6 +155,7 @@ export const CreatedUpcomingIssueListItem: React.FC<IssueListItemProps> = observ
if (!issue) return null;
const projectDetails = getProjectById(issue.project_id);
const targetDate = getDate(issue.target_date);
return (
<ControlLink
@ -170,11 +171,7 @@ export const CreatedUpcomingIssueListItem: React.FC<IssueListItemProps> = observ
<h6 className="text-sm flex-grow truncate">{issue.name}</h6>
</div>
<div className="text-xs text-center">
{issue.target_date
? isToday(new Date(issue.target_date))
? "Today"
: renderFormattedDate(issue.target_date)
: "-"}
{targetDate ? (isToday(targetDate) ? "Today" : renderFormattedDate(targetDate)) : "-"}
</div>
<div className="text-xs flex justify-center">
{issue.assignee_ids && issue.assignee_ids?.length > 0 ? (
@ -210,7 +207,7 @@ export const CreatedOverdueIssueListItem: React.FC<IssueListItemProps> = observe
const projectDetails = getProjectById(issue.project_id);
const dueBy = findTotalDaysInRange(getDate(issue.target_date), new Date(), false) ?? 0;
const dueBy: number = findTotalDaysInRange(getDate(issue.target_date), new Date(), false) ?? 0;
return (
<ControlLink