@sunbird-cb/utils-v2 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2090,7 +2090,16 @@ var EventService = (function () {
2090
2090
  };
2091
2091
  EventService.prototype.sortItemByTime = function (eventsdata) {
2092
2092
  return eventsdata.sort((function (a, b) {
2093
- return (a.eventDate === b.eventDate) ? 0 : b.eventDate ? -1 : 1;
2093
+ var firstDate = new Date(a.eventDate);
2094
+ var secondDate = new Date(b.eventDate);
2095
+ return secondDate > firstDate ? 1 : -1;
2096
+ }));
2097
+ };
2098
+ EventService.prototype.sortItemByTimeAsc = function (eventsdata) {
2099
+ return eventsdata.sort((function (a, b) {
2100
+ var firstDate = new Date(a.eventDate);
2101
+ var secondDate = new Date(b.eventDate);
2102
+ return secondDate < firstDate ? 1 : -1;
2094
2103
  }));
2095
2104
  };
2096
2105
  EventService.prototype.setEventListData = function (eventObj) {
@@ -2191,8 +2200,8 @@ var EventService = (function () {
2191
2200
  liveEvents = this.todaysLiveEvents;
2192
2201
  pastEvents = eventData.filter((function (pastEvent) { return pastEvent.isEventPast; }));
2193
2202
  futureEvents = eventData.filter((function (futureEvent) { return futureEvent.isEventFuture; }));
2194
- liveEvents = this.sortItemByTime(liveEvents);
2195
- futureEvents = this.sortItemByTime(futureEvents);
2203
+ liveEvents = this.sortItemByTimeAsc(liveEvents);
2204
+ futureEvents = this.sortItemByTimeAsc(futureEvents);
2196
2205
  pastEvents = this.sortItemByTime(pastEvents);
2197
2206
  this.todaysEvents = __spread(liveEvents, futureEvents, pastEvents);
2198
2207
  return this.todaysEvents;