Skip to content

Commit 28da5f9

Browse files
committed
feat: 🚧 add timezone_offset to clockin/switch #464
1 parent d43c072 commit 28da5f9

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/app/modules/shared/models/entry.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ export interface NewEntry {
1818
technologies?: string[];
1919
uri?: string;
2020
activity_id?: string;
21+
timezone_offset: number;
2122
}

src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ export class ProjectListHoverComponent implements OnInit, OnDestroy {
7878
}
7979

8080
clockIn(selectedProject, customerName, name) {
81-
const entry = { project_id: selectedProject, start_date: new Date().toISOString() };
81+
const entry = {
82+
project_id: selectedProject,
83+
start_date: new Date().toISOString(),
84+
timezone_offset: new Date().getTimezoneOffset(),
85+
};
8286
this.store.dispatch(new entryActions.CreateEntry(entry));
8387
this.projectsForm.setValue( { project_id: `${customerName} - ${name}`, } );
8488
}

src/app/modules/time-clock/store/entry.effects.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ export class EntryEffects {
2121
map((response) => {
2222
const stopDateForEntry = new Date(response.end_date);
2323
stopDateForEntry.setSeconds(stopDateForEntry.getSeconds() + 1 );
24-
return new actions.CreateEntry({ project_id: action.idProjectSwitching, start_date: stopDateForEntry.toISOString() });
24+
return new actions.CreateEntry({
25+
project_id: action.idProjectSwitching,
26+
start_date: stopDateForEntry.toISOString(),
27+
timezone_offset: new Date().getTimezoneOffset(),
28+
});
2529
}),
2630
catchError((error) => {
2731
this.toastrService.warning(error.error.message);

0 commit comments

Comments
 (0)