Skip to content

Commit c62802a

Browse files
authored
fix: TT-86 Change set hour in end_hour (#675)
1 parent 054807a commit c62802a

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

src/app/modules/shared/components/details-fields/details-fields.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
formControlName="end_hour"
141141
id="end_hour"
142142
class="timepicker-input"
143+
[defaultTime]="'00:00'"
143144
[class.timepicker-input--disabled]="!(project_id.value && project_name.value)"
144145
></ngx-timepicker-field>
145146
</div>

src/app/modules/shared/components/details-fields/details-fields.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ describe('DetailsFieldsComponent', () => {
318318

319319
component.onGoingToWorkOnThisChange({ currentTarget: { checked: false } });
320320

321-
expect(component.entryForm.patchValue).toHaveBeenCalledWith({ end_date: '2020-12-30', end_hour: '09:45', });
321+
expect(component.entryForm.patchValue).toHaveBeenCalledWith(
322+
{ end_date: '2020-12-30', end_hour: formatDate(new Date(), 'HH:mm', 'en'), }
323+
);
322324
});
323325

324326
it('when creating a new entry, then the new entry should be marked as not run', () => {

src/app/modules/shared/components/details-fields/details-fields.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
301301
if (!this.goingToWorkOnThis) {
302302
this.entryForm.patchValue({
303303
end_date: formatDate(get(this.entryToEdit, 'start_date', ''), DATE_FORMAT, 'en'),
304-
end_hour: formatDate(get(this.entryToEdit, 'start_date', '00:00'), 'HH:mm', 'en'),
304+
end_hour: formatDate(new Date(), 'HH:mm', 'en'),
305305
});
306306
}
307307
this.shouldRestartEntry = !this.entryToEdit?.running && this.goingToWorkOnThis;

0 commit comments

Comments
 (0)