@sprucelabs/spruce-calendar-components 24.2.26 → 24.2.27

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.
@@ -10,6 +10,7 @@ export default class EventDateTimeToolViewController extends AbstractViewControl
10
10
  private calendarVc;
11
11
  constructor(options: ViewControllerOptions & CalendarToolOptions);
12
12
  private handleSelectDateFromCalendar;
13
+ private get event();
13
14
  private promptForNavigationPreference;
14
15
  private getSelectedDate;
15
16
  private CardVc;
@@ -25,16 +25,23 @@ class EventDateTimeToolViewController extends AbstractViewController {
25
25
  }
26
26
  handleSelectDateFromCalendar({ dateTimeMs, }) {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
+ const { hour, minute, day, month } = this.dates.splitDate(this.event.startDateTimeMs);
29
+ const { day: newDay, month: newMonth } = this.dates.splitDate(dateTimeMs);
30
+ if (day === newDay && month === newMonth) {
31
+ return;
32
+ }
28
33
  const shouldBail = yield this.promptForNavigationPreference(dateTimeMs);
29
34
  if (shouldBail) {
30
35
  return;
31
36
  }
32
- const { hour, minute } = this.dates.splitDate(this.getContext().event.startDateTimeMs);
33
37
  const startDateTime = this.dates.setTimeOfDay(dateTimeMs, hour, minute, 0, 0);
34
38
  yield this.formVc.setValue('startDateTime', startDateTime);
35
39
  this.calendarVc.setSelectedDates([this.getSelectedDate(dateTimeMs)]);
36
40
  });
37
41
  }
42
+ get event() {
43
+ return this.getContext().event;
44
+ }
38
45
  promptForNavigationPreference(dateTimeMs) {
39
46
  return __awaiter(this, void 0, void 0, function* () {
40
47
  let shouldBail = false;
@@ -84,7 +91,7 @@ class EventDateTimeToolViewController extends AbstractViewController {
84
91
  });
85
92
  }
86
93
  getSelectedDate(dateTimeMs) {
87
- const { year, month, day } = this.dates.splitDate(dateTimeMs !== null && dateTimeMs !== void 0 ? dateTimeMs : this.getContext().event.startDateTimeMs);
94
+ const { year, month, day } = this.dates.splitDate(dateTimeMs !== null && dateTimeMs !== void 0 ? dateTimeMs : this.event.startDateTimeMs);
88
95
  return { year, month, day };
89
96
  }
90
97
  CardVc() {
@@ -118,7 +125,7 @@ class EventDateTimeToolViewController extends AbstractViewController {
118
125
  },
119
126
  ],
120
127
  values: {
121
- startDateTime: this.getContext().event.startDateTimeMs,
128
+ startDateTime: this.event.startDateTimeMs,
122
129
  },
123
130
  }));
124
131
  }
@@ -10,6 +10,7 @@ export default class EventDateTimeToolViewController extends AbstractViewControl
10
10
  private calendarVc;
11
11
  constructor(options: ViewControllerOptions & CalendarToolOptions);
12
12
  private handleSelectDateFromCalendar;
13
+ private get event();
13
14
  private promptForNavigationPreference;
14
15
  private getSelectedDate;
15
16
  private CardVc;
@@ -17,15 +17,22 @@ class EventDateTimeToolViewController extends heartwood_view_controllers_1.Abstr
17
17
  this.cardVc = this.CardVc();
18
18
  }
19
19
  async handleSelectDateFromCalendar({ dateTimeMs, }) {
20
+ const { hour, minute, day, month } = this.dates.splitDate(this.event.startDateTimeMs);
21
+ const { day: newDay, month: newMonth } = this.dates.splitDate(dateTimeMs);
22
+ if (day === newDay && month === newMonth) {
23
+ return;
24
+ }
20
25
  const shouldBail = await this.promptForNavigationPreference(dateTimeMs);
21
26
  if (shouldBail) {
22
27
  return;
23
28
  }
24
- const { hour, minute } = this.dates.splitDate(this.getContext().event.startDateTimeMs);
25
29
  const startDateTime = this.dates.setTimeOfDay(dateTimeMs, hour, minute, 0, 0);
26
30
  await this.formVc.setValue('startDateTime', startDateTime);
27
31
  this.calendarVc.setSelectedDates([this.getSelectedDate(dateTimeMs)]);
28
32
  }
33
+ get event() {
34
+ return this.getContext().event;
35
+ }
29
36
  async promptForNavigationPreference(dateTimeMs) {
30
37
  let shouldBail = false;
31
38
  const formattedDestination = this.dates.format(dateTimeMs, 'MMM do');
@@ -73,7 +80,7 @@ class EventDateTimeToolViewController extends heartwood_view_controllers_1.Abstr
73
80
  return shouldBail;
74
81
  }
75
82
  getSelectedDate(dateTimeMs) {
76
- const { year, month, day } = this.dates.splitDate(dateTimeMs !== null && dateTimeMs !== void 0 ? dateTimeMs : this.getContext().event.startDateTimeMs);
83
+ const { year, month, day } = this.dates.splitDate(dateTimeMs !== null && dateTimeMs !== void 0 ? dateTimeMs : this.event.startDateTimeMs);
77
84
  return { year, month, day };
78
85
  }
79
86
  CardVc() {
@@ -107,7 +114,7 @@ class EventDateTimeToolViewController extends heartwood_view_controllers_1.Abstr
107
114
  },
108
115
  ],
109
116
  values: {
110
- startDateTime: this.getContext().event.startDateTimeMs,
117
+ startDateTime: this.event.startDateTimeMs,
111
118
  },
112
119
  }));
113
120
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-calendar-components",
3
3
  "description": "Calendar components for working with calendars and Sprucebot.",
4
- "version": "24.2.26",
4
+ "version": "24.2.27",
5
5
  "skill": {
6
6
  "namespace": "calendar"
7
7
  },