28 day repeating dates

I'm honestly not sure if this will work or not (I'm not installing Vue/Vuetify just to verify this), but this will give you an idea of how to go about it:

allowedDates: () => {

  // repeat pattern - 1 for on, 0 for off
  const pattern = [1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0];

  // the first friday of the year you want to start the pattern on, in yyyy-mm-dd
  const startDate = new Date('2019-01-04');

  // get the numbered day of the year, e.g. 4th of February = 35th day of the year
  const startOfYear = new Date(new Date().getFullYear(), 0, 0);
  const diff = startDate - startOfYear;
  const dayOfYear = Math.floor(diff / 86400000);

  // relate the day of the year to the 1/0 in `pattern`
  const patternIndex = (dayOfYear - 1) % 28;

  // return true/false if `patternIndex` is a 1/0
  return !!pattern[patternIndex];

}

This relies on you defining the first Friday you want to start the pattern on. In theory it should work for every day after that forever. Let me know how it goes.

/r/learnjavascript Thread