I am currently facing an issue regarding passing a date value into the rrule plugin of a fullCalendar. Here is the snippet of code in question:
Endate = null;
rrule: {
freq: "Daily",
interval: 1,
dtstart: StartDate.toDate(),
until: EndDate.toDate()
}
Within my EndDate, you can notice that I am formatting it to .toDate(). However, there is a possibility that EndDate could also be null, leading to a failure when attempting to format it with .toDate()
My inquiry revolves around how I can successfully pass a null value if my EndDate is null, while using .toDate() if there is an actual value present.
I have attempted the following approach:
until: EndDate == ?? || EndDate.toDate()
// attempting to pass the value if not null, else pass null
Unfortunately, the above method did not yield the desired outcome.
I also experimented with:
until:EndDate === null ? null:EndDate.toDate() // although functional, I am seeking a more concise approach rather than reassigning endDate to null