Skip to content
Snippets Groups Projects

Resolve "Allow using time slot numbers in long term absences dialog (instead of datetimes)"

All threads resolved!
2 files
+ 11
5
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -186,16 +186,19 @@ export default {
getPeriodsForWeekday(weekday) {
// Adapt from python conventions
const pythonWeekday = weekday - 1;
return this.periodsByDay.find(
let periodsForWeekday = this.periodsByDay.find(
(period) => period.weekday === pythonWeekday,
).periods;
);
if (!periodsForWeekday) return false;
return periodsForWeekday.periods;
},
handleStartDate(date) {
this.start = DateTime.fromISO(date);
if (this.periodsByDay.length > 0) {
if (this.periodsByDay && this.periodsByDay.length > 0) {
// Select periods for day
this.startPeriods = this.getPeriodsForWeekday(this.start.weekday);
if (!this.startPeriods) return;
// Sync PeriodSelect
const startTime = this.start.toFormat("HH:mm:ss");
this.startSlot = this.startPeriods.find(
@@ -206,9 +209,10 @@ export default {
handleEndDate(date) {
this.end = DateTime.fromISO(date);
if (this.periodsByDay.length > 0) {
if (this.periodsByDay && this.periodsByDay.length > 0) {
// Select periods for day
this.endPeriods = this.getPeriodsForWeekday(this.end.weekday);
if (!this.endPeriods) return;
// Sync PeriodSelect
const endTime = this.end.toFormat("HH:mm:ss");
this.endSlot = this.endPeriods.find(
Loading