I have a list of task object that has a start_date and I want to query it by start_date range
For instance
start_date = "2021-04-04" #Sample Date
end_date = "2021-04-05" # Sample Date
task_history = TaskEmployeeHistory.objects.filter(
employee=employee, start_date__range=[start_date, end_date])
sample_response = [
{
"id": 24,
"start_date": "Apr 05, 2021 03:39:57 PM",
"end_date": "Apr 05, 2021 03:40:11 PM",
"employee_name": "User 1"
},
{
"id": 26,
"start_date": "Apr 06, 2021 05:39:54 PM",
"end_date": "Apr 06, 2021 05:40:05 PM",
"employee_name": "User 3"
},
]
Basically, I want to exclude the April 6, and only want the first item on the list (since the range of the start date is from April 4 to April 5 only), but the task_history returns empty QuerySet, why does it happened?