Skip to content

Commit

Permalink
Fix the handling of the schedule date and time to match the format is…
Browse files Browse the repository at this point in the history
…sued by the schedule microservice

Signed-off-by: Scott Stark <[email protected]>
  • Loading branch information
starksm64 committed Sep 28, 2017
1 parent a0ab638 commit 307bf71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions web-application/src/main/static/app/schedule/schedule.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//This is the same model our service emits
export class Schedule {
date: any;
date: string;
duration: string;
venue: string;
venueId: string;
startTime: any;
startTime: string;
id: string;
sessionId: string;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class SchedulesComponent implements OnInit {
});
this.sessionService.init(function () {
//no-op
console.log("Loaded sessions");
console.log("Loaded schedules");
});

this.header = {
Expand Down Expand Up @@ -73,6 +73,7 @@ export class SchedulesComponent implements OnInit {

setSchedules(schedules: Schedule[]): void {
this.schedules = schedules;
console.log("schedules.length: %d", this.schedules.length);
this.events = this.toEvents(this.schedules);
}

Expand All @@ -87,8 +88,10 @@ export class SchedulesComponent implements OnInit {
//date,duration,venue,venueId,startTime,id,sessionId
//dayOfWeek,month,dayOfMonth,dayOfYear,era,year,monthValue,chronology,leapYear

let d = new Date(s.date.monthValue + '/' + s.date.dayOfMonth + '/' + s.date.year);
let start = momentConstructor(d.toISOString().slice(0, 10)).add(s.startTime.hour, 'hours');
console.log(s);
var datetime = s.date + " " + s.startTime;
let d = new Date(datetime);
let start = momentConstructor(d.toISOString());
let end = start.add(1, 'hours');

if (self.defaultDate.isAfter(start)) {
Expand Down Expand Up @@ -145,4 +148,4 @@ export class SchedulesComponent implements OnInit {
console.error('An error occurred', error); // TODO - Display safe error
return Promise.reject(error.message || error);
}
}
}

0 comments on commit 307bf71

Please sign in to comment.