Skip to content

Commit f7c5927

Browse files
committed
Convert to EDT ai save restric
1 parent 63ed492 commit f7c5927

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

course-matrix/backend/src/utils/convert-time-string.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,16 @@ export function convertTimeStringToDate(timeString: string): Date {
1616
date.setSeconds(seconds);
1717
date.setMilliseconds(0);
1818

19-
return date;
19+
// Convert to EDT (GMT-4)
20+
// First get the UTC time by adding the local timezone offset
21+
const utcDate = new Date(date.getTime() + date.getTimezoneOffset() * 60000);
22+
23+
// Then subtract 4 hours for EDT
24+
const edtOffset = -4 * 60 * 60000;
25+
const edtDate = new Date(utcDate.getTime() + edtOffset);
26+
27+
console.log("Original date:", date);
28+
console.log("EDT date:", edtDate);
29+
30+
return edtDate;
2031
}

0 commit comments

Comments
 (0)