Browse Source

leverage EventDateProfile for selection/dayClick

Adam Shaw 8 năm trước cách đây
mục cha
commit
04f081ff81
1 tập tin đã thay đổi với 4 bổ sung15 xóa
  1. 4 15
      src/common/View.js

+ 4 - 15
src/common/View.js

@@ -840,16 +840,9 @@ var View = FC.View = ChronoComponent.extend({
 
 	// Triggers handlers to 'select'
 	triggerSelect: function(footprint, ev) {
-		var calendar = this.calendar;
-		var start = calendar.moment(footprint.unzonedRange.getStart());
-		var end = calendar.moment(footprint.unzonedRange.getEnd());
-
-		if (footprint.isAllDay) {
-			start.stripTime();
-			end.stripTime();
-		}
+		var dateProfile = this.calendar.footprintToDateProfile(footprint); // abuse of "Event"DateProfile?
 
-		this.publiclyTrigger('select', null, start, end, ev);
+		this.publiclyTrigger('select', null, dateProfile.start, dateProfile.end, ev);
 	},
 
 
@@ -948,13 +941,9 @@ var View = FC.View = ChronoComponent.extend({
 	// Triggers handlers to 'dayClick'
 	// Span has start/end of the clicked area. Only the start is useful.
 	triggerDayClick: function(footprint, dayEl, ev) {
-		var date = this.calendar.moment(footprint.unzonedRange.getStart()); // need the calendar's timezone
-
-		if (footprint.isAllDay) {
-			date.stripTime();
-		}
+		var dateProfile = this.calendar.footprintToDateProfile(footprint); // abuse of "Event"DateProfile?
 
-		this.publiclyTrigger('dayClick', dayEl, date, ev);
+		this.publiclyTrigger('dayClick', dayEl, dateProfile.start, ev);
 	}
 
 });