JSFiddle - React, Tailwind, and code Playground

by the_archer

HTML

<script src="https://raw.github.com/timrwood/moment/1.6.2/min/moment.min.js"></script>

JavaScript

function Tasker() {

    this.dayStack = [];
    var deckSelf = this;
    localStorage.clear();
    
    this.addDay = function(dateOfDay) {
        this.dayStack.push(new Day(dateOfDay));
    };
    
  
    function Day(dayDate) {
        this.dateOfDay = dayDate;
        this.entryStack = [];

        this.addEntry = function(priority, status, entryType, entryTitle) {
            this.entryStack.push(new Entry(generateUniqueID("entryID"), priority, status, entryType, entryTitle));
        };

        this.removeEntry = function(entryID) {
            this.entryStack.splice(entryID, 1); //first number = index of entry to remove.
        };

        function Entry(generatedID, priority, status, Type, Title) {
            this.entryID = generatedID;
            this.entryPriority = priority;
            this.entryStatus = status;
            this.entryType = Type;
            this.entryTitle = Title;
        }
    }

    //Common Functions

    function generateUniqueID(typeOfID) {
        var lastGeneratedID = parseInt(localStorage.getItem(typeOfID), 10);
        if (isNaN(lastGeneratedID)) {
            localStorage.setItem(typeOfID, 0);
            return 0;
        }
        else {
            localStorage.setItem(typeOfID, lastGeneratedID + 1);
            return parseInt(localStorage.getItem(typeOfID), 10);
        }
    }
}

//Clientside Code
var hr = new Tasker();
hr.addDay("01/08/89");
console.log(hr);