Hello Everyone,
I’m trying to query a list of Events in the Event Doctype of the Core Module. It works when I pass a date but not when I pass a DateTime object. See my code below.
NOTE: All my Event Types are Public
What I’m trying to achieve is to return open events given a start datetime and end datetime constrain
Thanks a lot!
@frappe.whitelist()
def search_free_schedule(time_from, time_to):
from_datetime_object = datetime.strptime(time_from, "%Y-%m-%d %H:%M:%S")
to_datetime_object = datetime.strptime(time_to, "%Y-%m-%d %H:%M:%S")
testing_return = []
free_sched = frappe.db.get_list(
"Event",
# filters={"starts_on": [">=", time_from], "ends_on": ["<=", time_to]},
filters=[["ends_on", "between", [time_from, time_to]]],
)
testing_return.append(free_sched)
return testing_return