Skip to content

Commit c26fff8

Browse files
committed
grandfather in functionality for db.date bc its only used in one spot
1 parent 943aba6 commit c26fff8

4 files changed

Lines changed: 17 additions & 14 deletions

File tree

src/backend/src/utils/change-requests.utils.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import {
2121
WorkPackageProposedChangesCreateArgs,
2222
WorkPackageStage,
2323
User,
24-
formatDateOnly,
25-
toDateString
24+
formatDateOnly
2625
} from 'shared';
2726
import { DeletedException, HttpException, NotFoundException } from './errors.utils.js';
2827
import { ChangeRequestStatus } from 'shared';
@@ -449,7 +448,7 @@ export const applyWorkPackageProposedChanges = async (
449448
workPackageProposedChanges.wbsProposedChanges.name,
450449
crId,
451450
workPackageProposedChanges.stage as WorkPackageStage,
452-
toDateString(workPackageProposedChanges.startDate),
451+
workPackageProposedChanges.startDate.toISOString().split('T')[0],
453452
workPackageProposedChanges.duration,
454453
workPackageProposedChanges.blockedBy,
455454
workPackageProposedChanges.wbsProposedChanges.proposedDescriptionBulletChanges.map(
@@ -465,7 +464,7 @@ export const applyWorkPackageProposedChanges = async (
465464
wbsProposedChanges.name,
466465
crId,
467466
workPackageProposedChanges.stage as WorkPackageStage,
468-
toDateString(workPackageProposedChanges.startDate),
467+
workPackageProposedChanges.startDate.toISOString().split('T')[0],
469468
workPackageProposedChanges.duration,
470469
workPackageProposedChanges.blockedBy,
471470
wbsProposedChanges.proposedDescriptionBulletChanges.map(descriptionBulletToDescriptionBulletPreview),

src/frontend/src/apis/work-packages.api.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
*/
55

66
import axios from '../utils/axios';
7-
import { dateToMidnightUTC, DescriptionBulletPreview, WbsNumber, WorkPackage, WorkPackagePreview, WorkPackageStage } from 'shared';
7+
import {
8+
dateToMidnightUTC,
9+
DescriptionBulletPreview,
10+
WbsNumber,
11+
WorkPackage,
12+
WorkPackagePreview,
13+
WorkPackageStage
14+
} from 'shared';
815
import { wbsPipe } from '../utils/pipes';
916
import { apiUrls } from '../utils/urls';
1017
import { workPackagePreviewTransformer, workPackageTransformer } from './transformers/work-packages.transformers';

src/frontend/src/pages/CalendarPage/CalendarWeekView.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,12 @@ const CalendarWeekView: React.FC<CalendarWeekViewProps> = ({
224224
);
225225

226226
// Build per-day task lists (tasks appear on their deadline day)
227-
// Task deadlines are date-only values (@db.Date, midnight UTC).
228-
// Extract UTC components from deadline, local components from weekDay, and compare.
227+
// Task deadlines are date-only values normalized to local midnight by dbDateToLocalDate
228+
// in the transformer, so compare local components on both sides.
229229
const tasksByDay: CalendarTask[][] = weekDays.map((day) =>
230230
tasks.filter((t) => {
231231
if (!t.deadline) return false;
232-
const d = new Date(t.deadline);
233-
return (
234-
d.getUTCFullYear() === day.getFullYear() && d.getUTCMonth() === day.getMonth() && d.getUTCDate() === day.getDate()
235-
);
232+
return isSameDay(new Date(t.deadline), day);
236233
})
237234
);
238235

src/frontend/src/pages/GanttPage/GanttChart/GanttChartComponents/GanttTaskBar/GanttTaskBar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ const GanttTaskBar = <T,>({
4545
highlightTaskComparator
4646
}: GanttTaskBarProps<T>) => {
4747
const getStartCol = (start: Date) => {
48-
const startCol = days.findIndex((day) => toDateString(day) === toDateString(getMonday(start, true))) + 1;
48+
const startCol = days.findIndex((day) => toDateString(day) === toDateString(getMonday(start))) + 1;
4949
return startCol;
5050
};
5151

5252
const getEndCol = (end: Date) => {
5353
const endCol =
54-
days.findIndex((day) => toDateString(day) === toDateString(getMonday(end, true))) === -1
54+
days.findIndex((day) => toDateString(day) === toDateString(getMonday(end))) === -1
5555
? days.length + 1
56-
: days.findIndex((day) => toDateString(day) === toDateString(getMonday(end, true))) + 2;
56+
: days.findIndex((day) => toDateString(day) === toDateString(getMonday(end))) + 2;
5757
return endCol;
5858
};
5959

0 commit comments

Comments
 (0)