Skip to content

Commit 8d4984d

Browse files
authored
Merge pull request #394 from ioet/392-save-data-using-utc
fix: #392 save data using UTC
2 parents 553645b + a1c7b63 commit 8d4984d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/app/modules/time-entries/pages/time-entries.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ describe('TimeEntriesComponent', () => {
139139
it('when saving time entries, the time entries should be queried', () => {
140140
const currentMonth = new Date().getMonth() + 1;
141141
const entryToSave = {
142-
project_id: 'project-id'
142+
project_id: 'project-id',
143+
end_date: new Date(),
144+
start_date: new Date()
143145
};
144146
component.activeTimeEntry = null;
145147
spyOn(store, 'dispatch');

src/app/modules/time-entries/pages/time-entries.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export class TimeEntriesComponent implements OnInit {
5858

5959
doSave(entry) {
6060
entry.start_date = new Date(entry.start_date).toISOString();
61-
entry.end_date = new Date(entry.end_date).toISOString();
61+
if (entry.end_date !== null && entry.end_date !== undefined) {
62+
entry.end_date = new Date(entry.end_date).toISOString();
63+
}
6264
if (this.entryId) {
6365
entry.id = this.entryId;
6466
this.store.dispatch(new entryActions.UpdateEntry(entry));

0 commit comments

Comments
 (0)