Finding number of days until a certain date
const currentDay = moment().format('D');


You use .format() a lot, instead use Moment.js's getters like .date(). This way you also don't have to use parseInt() since the getters return number's.



What about this solution:

const getDaysTillSalary = (day) =&gt; {
  let date = moment();
  let days = 0;
  while(date.date() !== 8) {
    date = date.add(1, 'day');
    days++;
  }
  return days;
}


It creates a variable and stores the current Moment.js date in it. Then it repeatedly adds one day using .add() and counts up until date.date() (the day of the month) returns 8. The days variable is then returned.