JSFiddle - React, Tailwind, and code Playground

by Mubasshir Pawle

TypeScript

function getIncreaseDateBy() {
    return '+10 years';
}

function midnight(date) {
    if (empty(date)) {
        date = getIncreaseDateBy();
    }
    return strtotime('midnight', strtotime(date));
}

function getTimeline(label, date, status = '') {
    //check if originally empty
    if (strtotime('midnight', date) === strtotime('midnight', strtotime(getIncreaseDateBy()))) {
        date = 'NA';
    } else {
        date = date('D, d M', date);
    }
    return '<li class="li ' + str_replace(' ', '-', status) + '">\n\
            <div class="timestamp">\n\
              <span class="task-date">' + date + '<span>\n\
            </div>\n\
            <div class="status">\n\
              <h4>' + label + '</h4>\n\
            </div>\n\
          </li>';
}