@@ -49,6 +49,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
4949 activity_id : [ '' , Validators . required ] ,
5050 description : '' ,
5151 entry_date : '' ,
52+ departure_date : '' ,
5253 start_hour : '' ,
5354 end_hour : '' ,
5455 uri : '' ,
@@ -130,6 +131,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
130131 activity_id : this . entryToEdit . activity_id ,
131132 description : this . entryToEdit . description ,
132133 entry_date : this . entryToEdit . start_date ? formatDate ( this . entryToEdit . start_date , 'yyyy-MM-dd' , 'en' ) : '' ,
134+ departure_date : formatDate ( this . entryToEdit . end_date ? this . entryToEdit . end_date : new Date ( ) , 'yyyy-MM-dd' , 'en' ) ,
133135 start_hour : this . entryToEdit . start_date ? formatDate ( this . entryToEdit . start_date , 'HH:mm:ss' , 'en' ) : '00:00:00' ,
134136 end_hour : this . entryToEdit . end_date ? formatDate ( this . entryToEdit . end_date , 'HH:mm:ss' , 'en' ) : '00:00:00' ,
135137 uri : this . entryToEdit . uri ,
@@ -148,6 +150,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
148150 activity_id : '' ,
149151 description : '' ,
150152 entry_date : formatDate ( new Date ( ) , 'yyyy-MM-dd' , 'en' ) ,
153+ departure_date : formatDate ( new Date ( ) , 'yyyy-MM-dd' , 'en' ) ,
151154 start_hour : '00:00:00' ,
152155 end_hour : '00:00:00' ,
153156 uri : '' ,
@@ -175,6 +178,10 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
175178 return this . entryForm . get ( 'entry_date' ) ;
176179 }
177180
181+ get departure_date ( ) {
182+ return this . entryForm . get ( 'departure_date' ) ;
183+ }
184+
178185 get start_hour ( ) {
179186 return this . entryForm . get ( 'start_hour' ) ;
180187 }
@@ -195,13 +202,14 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
195202 }
196203 // start&end date same for now
197204 const entryDate = this . entryForm . value . entry_date ;
205+ const departureDate = this . entryForm . value . departure_date ;
198206 const entry = {
199207 project_id : this . entryForm . value . project_id ,
200208 activity_id : this . entryForm . value . activity_id ,
201209 technologies : this . selectedTechnologies ? this . selectedTechnologies : [ ] ,
202210 description : this . entryForm . value . description ,
203211 start_date : new Date ( `${ entryDate } T${ this . entryForm . value . start_hour . trim ( ) } ` ) . toISOString ( ) ,
204- end_date : new Date ( `${ entryDate } T${ this . entryForm . value . end_hour . trim ( ) } ` ) . toISOString ( ) ,
212+ end_date : new Date ( `${ departureDate } T${ this . entryForm . value . end_hour . trim ( ) } ` ) . toISOString ( ) ,
205213 uri : this . entryForm . value . uri ,
206214 timezone_offset : new Date ( ) . getTimezoneOffset ( ) ,
207215 } ;
0 commit comments