Search code examples
lodash

Unable to filter using lodash | nuxt


How can I filter using lodash, I use the response of an axios call to get the data

var wahahaha = _.filter(response.data.results, o => o.date >= this.$data.endofMonth && o.date <= this.$data.startofMonth);
      console.log(wahahaha)

How can I query using the function


Solution

  • It seems like you have the date ranges swapped:

    _.filter(response.data.results, o => o.date >= this.$data.startofMonth && o.date <= this.$data.endofMonth)
    

    Should be less than end of month and bigger than start of the month no?