JSFiddle - React, Tailwind, and code Playground

by 14rego

HTML

<h6 id="holder-web-data"></h6>

JavaScript

$.nextDayA = function (year, month, day) {
  var jMo = parseInt(month) - 1;
  var today = new Date(year, jMo, day);
  var tomorrow = new Date(today.getTime() + (24 * 60 * 60 * 1000));
  var nextDy = tomorrow.getDate();
  var nextMo = tomorrow.getMonth() + 1;
  var nextYr = tomorrow.getFullYear();
  if (nextDy < 10) {
    nextDy = '0' + nextDy;
  }
  if (nextMo < 10) {
    nextMo = '0' + nextMo;
  }
  var tomDate = parseInt(nextYr + '' + nextMo + '' + nextDy);
  return tomDate;
};
$.nextDayB = function (year, month, day) {
  var thisYear = parseInt(year);
  var thisMonth = parseInt(month);
  var thisDay = parseInt(day);
  if (year % 4 == 0) {
    var leap = 'yes';
  } else {
    var leap = 'no';
  }
  var nextDy = thisDay + 1;
  if (nextDy > 28 && thisMonth === 2 && leap === 'no') {
    var nextDy = 1;
    var nextMo = thisMonth + 1;
  } else if (nextDy > 29 && thisMonth === 2 && leap === 'yes') {
    var nextDy = 1;
    var nextMo = thisMonth + 1;
  } else if (nextDy > 30 && (thisMonth === 2 || thisMonth === 4 || thisMonth === 6 || thisMonth === 9 || thisMonth === 11)) {
    var nextDy = 1;
    var nextMo = thisMonth + 1;
  } else if (nextDy > 31 && (thisMonth === 1 || thisMonth === 3 || thisMonth === 5 || thisMonth === 7 || thisMonth === 8 || thisMonth === 10 || thisMonth === 12)) {
    var nextDy = 1;
    var nextMo = thisMonth + 1;
  } else {
    var nextMo = thisMonth;
  }
  if (nextMo === 13) {
    var nextMo = 1;
    var nextYr = thisYear + 1;
  } else {
    var nextYr = thisYear;
  }

  if (nextDy < 10) {
    nextDy.toString();
    var strDy = '0' + nextDy;
  } else {
    var strDy = nextDy.toString();
  }
  if (nextMo < 10) {
    nextMo.toString();
    var strMo = '0' + nextMo;
  } else {
    var strMo = nextMo.toString();
  }

  var strYr = nextYr.toString();
  var strDate = strYr + '' + strMo + '' + strDy;
  var tomDate = parseInt(strDate);
  return tomDate;
};

$.buildCATS = function (starter, ender) {

  var starterCATS = parseInt(starter);
  while...