I have a group of users who need to save their availability. Currently, I am utilizing Full Calendar and looking for a way to prevent them from adding the same event multiple times on a single day. My tech stack includes VueJs and all events are stored in the global store. Here's what I've attempted so far:
handleSelect(arg) {
let index = this.$store.getters.EVENTS.findIndex((_event) => _event.start == arg.start);
if (index == -1) {
this.$store.dispatch("ADD_EVENT", {
id: new Date().getTime(),
title: this.title,
start: arg.start,
end: arg.end,
allDay: arg.allDay,
});
}
},
Despite both _event.start and arg.start showing as the same value when logged to the console, the index is always returning -1. Can anyone shed some light on why this might be happening?