Exercise Tracker - From, to , limit

I’m stuck with the last test:

You can add from , to and limit parameters to a GET /api/users/:_id/logs request to retrieve part of the log of any user. from and to are dates in yyyy-mm-dd format. limit is an integer of how many logs to send back.

I cannot seem to find what’s wrong, can anybody please explain?

This is my code below.

app.get('/api/users/:_id/logs', function(req, res) {
  USERS.findById(req.params['_id'], (err, user) => {
    if (err) {
      console.log(err);
    } else {
      let userData = { ...user._doc };

      const { from, to, limit } = req.query;

      if (from) {
        console.log(from);
        const fromDate = new Date(from);
        userData.log = userData.log.filter((exercise) => {
          new Date(exercise.date) > fromDate;
        })
      }

      if (to) {
        console.log(to);
        const toDate = new Date(to);
        userData.log = userData.log.filter((exercise) => {
          new Date(exercise.date) < toDate;
        })
      }

      if (limit) {
        console.log(limit);
        userData.log = userData.log.slice(0, limit);
      }

      userData.count = user.log.length;
      res.json(userData);
      console.log(userData);
    }
  })
})

solution: https://replit.com/@sergiomateu/boilerplate-project-exercisetracker

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge: Exercise Tracker

Link to the challenge: