Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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 @@ -381,14 +381,19 @@ describe('TimeEntriesComponent', () => {
it('should preload data of last entry when a project is selected while creating new entry ', waitForAsync(() => {
component.entry = null;
component.entryId = null;
const defaultSeconds = 0;
const currentDate = new Date();
currentDate.setSeconds(defaultSeconds);
currentDate.setMilliseconds(defaultSeconds);
const emptyDate = new Date(new Date().setHours(0, 0, 0, 0));
const lastEntry = {
description: 'testing is fun',
technologies: [],
uri: 'http://testing.is.fun',
activity_id: 'sss',
project_id: 'id',
start_date: new Date(),
end_date: new Date(new Date().setHours(0, 0, 0, 0))
start_date: currentDate,
end_date: emptyDate
};
state.timeEntriesDataSource.data = [lastEntry];
mockEntriesSelector = store.overrideSelector(getTimeEntriesDataSource, state.timeEntriesDataSource);
Expand Down
10 changes: 7 additions & 3 deletions src/app/modules/time-entries/pages/time-entries.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,19 @@ export class TimeEntriesComponent implements OnInit, OnDestroy {
this.store.pipe(select(getTimeEntriesDataSource)).subscribe(ds => {
const dataToUse = ds.data.find(item => item.project_id === event.projectId);
if (dataToUse && this.isNewEntry()) {
const startDate = new Date(new Date().setHours(0, 0, 0, 0));
const defaultSeconds = 0;
const currentDate = new Date();
currentDate.setSeconds(defaultSeconds);
currentDate.setMilliseconds(defaultSeconds);
const emptyDate = new Date(new Date().setHours(0, 0, 0, 0));
const entry = {
description: dataToUse.description ? dataToUse.description : '',
technologies: dataToUse.technologies ? dataToUse.technologies : [],
uri: dataToUse.uri ? dataToUse.uri : '',
activity_id: dataToUse.activity_id,
project_id: dataToUse.project_id,
start_date: new Date(),
end_date: startDate
start_date: currentDate,
end_date: emptyDate
};
this.entry = entry;
}
Expand Down