@@ -42,6 +42,8 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
42
42
activities : Activity [ ] = [ ] ;
43
43
goingToWorkOnThis = false ;
44
44
shouldRestartEntry = false ;
45
+ starDateValue ;
46
+ endDateValue ;
45
47
46
48
constructor ( private formBuilder : FormBuilder , private store : Store < Merged > ,
47
49
private actionsSubject$ : ActionsSubject , private toastrService : ToastrService ) {
@@ -139,6 +141,8 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
139
141
uri : this . entryToEdit . uri ,
140
142
technology : '' ,
141
143
} ) ;
144
+ this . starDateValue = formatDate ( get ( this . entryToEdit , 'start_date' , '00:00' ) , 'HH:mm' , 'en' ) ;
145
+ this . endDateValue = formatDate ( get ( this . entryToEdit , 'end_date' , '00:00' ) , 'HH:mm' , 'en' ) ;
142
146
} else {
143
147
this . cleanForm ( ) ;
144
148
}
@@ -204,13 +208,20 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
204
208
}
205
209
const startDate = this . entryForm . value . start_date ;
206
210
const endDate = this . entryForm . value . end_date ;
211
+ this . starDateValue = this . entryForm . value . start_hour === this . starDateValue ?
212
+ this . entryToEdit . start_date :
213
+ new Date ( `${ startDate } T${ this . entryForm . value . start_hour . trim ( ) } ` ) . toISOString ( ) ;
214
+ this . endDateValue = this . entryForm . value . end_hour === this . endDateValue ?
215
+ this . entryToEdit . end_date :
216
+ new Date ( `${ endDate } T${ this . entryForm . value . end_hour . trim ( ) } ` ) . toISOString ( ) ;
217
+
207
218
const entry = {
208
219
project_id : this . entryForm . value . project_id ,
209
220
activity_id : this . entryForm . value . activity_id ,
210
221
technologies : get ( this , 'selectedTechnologies' , [ ] ) ,
211
222
description : this . entryForm . value . description ,
212
- start_date : new Date ( ` ${ startDate } T ${ this . entryForm . value . start_hour . trim ( ) } ` ) . toISOString ( ) ,
213
- end_date : new Date ( ` ${ endDate } T ${ this . entryForm . value . end_hour . trim ( ) } ` ) . toISOString ( ) ,
223
+ start_date : this . starDateValue ,
224
+ end_date : this . endDateValue ,
214
225
uri : this . entryForm . value . uri ,
215
226
timezone_offset : new Date ( ) . getTimezoneOffset ( ) ,
216
227
} ;
0 commit comments