@@ -49,6 +49,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
49
49
activity_id : [ '' , Validators . required ] ,
50
50
description : '' ,
51
51
entry_date : '' ,
52
+ departure_date : '' ,
52
53
start_hour : '' ,
53
54
end_hour : '' ,
54
55
uri : '' ,
@@ -130,6 +131,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
130
131
activity_id : this . entryToEdit . activity_id ,
131
132
description : this . entryToEdit . description ,
132
133
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' ) ,
133
135
start_hour : this . entryToEdit . start_date ? formatDate ( this . entryToEdit . start_date , 'HH:mm:ss' , 'en' ) : '00:00:00' ,
134
136
end_hour : this . entryToEdit . end_date ? formatDate ( this . entryToEdit . end_date , 'HH:mm:ss' , 'en' ) : '00:00:00' ,
135
137
uri : this . entryToEdit . uri ,
@@ -148,6 +150,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
148
150
activity_id : '' ,
149
151
description : '' ,
150
152
entry_date : formatDate ( new Date ( ) , 'yyyy-MM-dd' , 'en' ) ,
153
+ departure_date : formatDate ( new Date ( ) , 'yyyy-MM-dd' , 'en' ) ,
151
154
start_hour : '00:00:00' ,
152
155
end_hour : '00:00:00' ,
153
156
uri : '' ,
@@ -175,6 +178,10 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
175
178
return this . entryForm . get ( 'entry_date' ) ;
176
179
}
177
180
181
+ get departure_date ( ) {
182
+ return this . entryForm . get ( 'departure_date' ) ;
183
+ }
184
+
178
185
get start_hour ( ) {
179
186
return this . entryForm . get ( 'start_hour' ) ;
180
187
}
@@ -195,13 +202,14 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
195
202
}
196
203
// start&end date same for now
197
204
const entryDate = this . entryForm . value . entry_date ;
205
+ const departureDate = this . entryForm . value . departure_date ;
198
206
const entry = {
199
207
project_id : this . entryForm . value . project_id ,
200
208
activity_id : this . entryForm . value . activity_id ,
201
209
technologies : this . selectedTechnologies ? this . selectedTechnologies : [ ] ,
202
210
description : this . entryForm . value . description ,
203
211
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 ( ) ,
205
213
uri : this . entryForm . value . uri ,
206
214
timezone_offset : new Date ( ) . getTimezoneOffset ( ) ,
207
215
} ;
0 commit comments