Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('MonthPickerComponent', () => {
it('selectMonth should call selectDate', () => {
spyOn(component, 'selectDate');
component.selectMonth(10);
expect(component.selectDate).toHaveBeenCalledWith(10, 2020);
expect(component.selectDate).toHaveBeenCalledWith(10, 2021);
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class EntryFieldsComponent implements OnInit {
return;
}

const lastEntryStartDate = get(this.lastEntry, 'start_date', moment().subtract(1, 'hours'));
const lastEntryStartDate = get(this.lastEntry, 'start_date', moment(newHourEntered).subtract(1, 'minutes'));
const isEntryDateInLastStartDate = moment(newHourEntered).isSameOrBefore(lastEntryStartDate);
if (isEntryDateInLastStartDate) {
this.toastrService.error('There is another time entry registered in this time range');
Expand Down
2 changes: 1 addition & 1 deletion src/app/modules/time-clock/store/entry.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class EntryEffects {
}).pipe(
map((entries) => {
const lastEntry = entries[1];
const isStartTimeInLastEntry = moment(entry.start_date).isBefore(lastEntry.end_date);
const isStartTimeInLastEntry = lastEntry && moment(entry.start_date).isBefore(lastEntry.end_date);
if (isStartTimeInLastEntry) {
return new actions.UpdateEntry({ id: lastEntry.id, end_date: entry.start_date });
} else {
Expand Down