Skip to content

Commit e0db25a

Browse files
removed date fix up to reflect updated api date handling (#346)
1 parent 2908cba commit e0db25a

File tree

4 files changed

+8
-34
lines changed

4 files changed

+8
-34
lines changed

package-lock.json

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/data/result/result-data.service.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class ResultDataService {
111111
take(1)
112112
)
113113
.subscribe((results) => {
114-
results.forEach((r) => this.fixDates(r));
114+
results.forEach((r) => this.setAsDates(r));
115115
this.setStore(results);
116116
});
117117
}
@@ -122,7 +122,7 @@ export class ResultDataService {
122122
.getScenarioResults(scenarioId)
123123
.pipe(take(1))
124124
.subscribe((results) => {
125-
results.forEach((r) => this.fixDates(r));
125+
results.forEach((r) => this.setAsDates(r));
126126
this.setStore(results);
127127
});
128128
}
@@ -132,7 +132,7 @@ export class ResultDataService {
132132
.getTaskResults(taskId)
133133
.pipe(take(1))
134134
.subscribe((results) => {
135-
results.forEach((r) => this.fixDates(r));
135+
results.forEach((r) => this.setAsDates(r));
136136
this.updateStoreMany(results);
137137
});
138138
}
@@ -143,7 +143,7 @@ export class ResultDataService {
143143
.getUserResults(userId)
144144
.pipe(take(1))
145145
.subscribe((results) => {
146-
results.forEach((r) => this.fixDates(r));
146+
results.forEach((r) => this.setAsDates(r));
147147
this.setStore(results);
148148
});
149149
}
@@ -154,7 +154,7 @@ export class ResultDataService {
154154
.getViewResults(viewId)
155155
.pipe(take(1))
156156
.subscribe((results) => {
157-
results.forEach((r) => this.fixDates(r));
157+
results.forEach((r) => this.setAsDates(r));
158158
this.setStore(results);
159159
});
160160
}
@@ -164,7 +164,7 @@ export class ResultDataService {
164164
.getVmResults(vmId)
165165
.pipe(take(1))
166166
.subscribe((results) => {
167-
results.forEach((r) => this.fixDates(r));
167+
results.forEach((r) => this.setAsDates(r));
168168
this.updateStoreMany(results);
169169
});
170170
}
@@ -174,7 +174,7 @@ export class ResultDataService {
174174
.getResult(id)
175175
.pipe(take(1))
176176
.subscribe((result) => {
177-
this.fixDates(result);
177+
this.setAsDates(result);
178178
this.updateStore({ ...result });
179179
});
180180
}
@@ -256,14 +256,6 @@ export class ResultDataService {
256256
}
257257
}
258258

259-
fixDates(result: Result) {
260-
// set as date object and handle c# not adding 'Z' to UTC dates.
261-
result.dateCreated = new Date(result.dateCreated + 'Z');
262-
result.dateModified = new Date(result.dateModified + 'Z');
263-
result.statusDate = new Date(result.statusDate + 'Z');
264-
result.sentDate = new Date(result.sentDate + 'Z');
265-
}
266-
267259
setAsDates(result: Result) {
268260
// set to a date object.
269261
result.dateCreated = new Date(result.dateCreated);

src/app/data/scenario/scenario-data.service.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export class ScenarioDataService {
190190
.subscribe(
191191
(scenarios) => {
192192
scenarios.forEach((scenario) => {
193-
this.fixDates(scenario);
193+
this.setAsDates(scenario);
194194
});
195195
this.scenarioStore.set(
196196
scenarios.filter(
@@ -384,14 +384,6 @@ export class ScenarioDataService {
384384
this.scenarioStore.remove(id);
385385
}
386386

387-
fixDates(scenario: Scenario) {
388-
// set as date object and handle c# not adding 'Z' to UTC dates.
389-
scenario.dateCreated = new Date(scenario.dateCreated + 'Z');
390-
scenario.dateModified = new Date(scenario.dateModified + 'Z');
391-
scenario.startDate = new Date(scenario.startDate + 'Z');
392-
scenario.endDate = new Date(scenario.endDate + 'Z');
393-
}
394-
395387
setAsDates(scenario: Scenario) {
396388
// set to a date object.
397389
scenario.dateCreated = new Date(scenario.dateCreated);

src/app/data/task/task-data.service.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,6 @@ export class TaskDataService {
384384
}
385385
}
386386

387-
fixDates(result: Result) {
388-
// set as date object and handle c# not adding 'Z' to UTC dates.
389-
result.dateCreated = new Date(result.dateCreated + 'Z');
390-
result.dateModified = new Date(result.dateModified + 'Z');
391-
result.statusDate = new Date(result.statusDate + 'Z');
392-
result.sentDate = new Date(result.sentDate + 'Z');
393-
}
394-
395387
setAsDates(result: Result) {
396388
// set to a date object.
397389
result.dateCreated = new Date(result.dateCreated);

0 commit comments

Comments
 (0)