I am currently trying to retrieve data using specific filters. The condition is that if the timestamp falls between 08:00:00 and 16:00:00 for a particular date, it should return results. The filter for $gte than 16:00:00 is working correctly, but the $lte one is not.
Timestamp of work.time.work_time.start_time equals to 1680940800000
Timestamp of requestBooking.booking.estimated_start_time is 1680919200000
Here is the code snippet (it should fail, however surprisingly it is not failing).
const bookingObject = await this.bookingRepository.findOne({
user_id: body.worker_id,
'work.date': requestBooking.booking.date,
'work.time.work_time.start_time': {
$lte: requestBooking.booking.estimated_start_time,
},
'work.time.work_time.end_time': {
$gte: requestBooking.booking.estimated_start_time + 1800000, // Adding 30 minutes
},
});