`self.options.lastDate` should not be updated if date is undefined. and this if statement can be simpler.

    if (date && self.options.lastDate === date)

and then where `self.options.lastDate` is set

    if (date) {
      self.options.lastDate = date;
    }