File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
frontend/src/app/components/create-assignment Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,6 @@ export class CreateAssignmentComponent implements OnInit {
8686
8787 create ( ) : void {
8888 const newAssignment : NewAssignment | null = this . extractFormValues ( ) ;
89-
9089 if ( newAssignment ) {
9190 this . assignmentService . createAssignment ( newAssignment ) . subscribe ( ( response ) => {
9291
@@ -131,11 +130,26 @@ export class CreateAssignmentComponent implements OnInit {
131130 const extraInstructions = this . createForm . get ( 'extraInstructions' ) ?. value ;
132131
133132 if ( classId && startDate && deadline ) {
133+ // Make this safe date so converting to UTC doesn't change the day
134+ // This can be done in a beter way and should be done in the future, but for now this fix works
135+ const safeStart = new Date (
136+ startDate . getFullYear ( ) ,
137+ startDate . getMonth ( ) ,
138+ startDate . getDate ( ) ,
139+ 12 , 0 , 0
140+ ) ;
141+
142+ const safeDeadline = new Date (
143+ deadline . getFullYear ( ) ,
144+ deadline . getMonth ( ) ,
145+ deadline . getDate ( ) ,
146+ 12 , 0 , 0
147+ ) ;
134148 return {
135149 classId,
136150 learningPathId : this . learningPathId ,
137- startDate,
138- deadline,
151+ startDate : safeStart ,
152+ deadline : safeDeadline ,
139153 extraInstructions,
140154 name
141155 } ;
You can’t perform that action at this time.
0 commit comments