JSFiddle - React, Tailwind, and code Playground

by Terrance Smith

JavaScript

//usage: var str = " somestring ".trim();
//output: "somestring"
//Credits to http://blog.stevenlevithan.com/archives/faster-trim-javascript
String.prototype.trim = function () {
    return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
};

String.isNullOrEmpty = function (value) {
    try {
        value = value.toString();
    } catch (e) {
        return true;
    }
    return (!value || value === undefined || value === "" || value.length === 0);
};

String.isNullOrWhiteSpace = function (value) {
    return (String.isNullOrEmpty(value.trim()));
};

// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function (from, to) {
    var rest = this.slice((to || from) + 1 || this.length);
    this.length = from < 0 ? this.length + from : from;
    return this.push.apply(this, rest);
};

var militaryTimeFixer = function (dt) {
    var result = dt;
    if (new Date(dt) == "Invalid Date") {
        result = dt.replace(/am|pm/i, "");
    }
    return result;
};


//Checks if the start date is before the end date
//returns true if end is later than start
dateCompare = function (start, end) {
    var result = false;
    var testdt1 = new Date(militaryTimeFixer(start.toString()));
    var testdt2 = new Date(militaryTimeFixer(end.toString()));
    result = (testdt1 <= testdt2);
    return result;
};


function isUnsignedInteger(s) {
    return (s.toString().search(/^[0-9]+$/) === 0);
}

function isDate(value) {
    var dateRegEx = new RegExp(/^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/);
    if (dateRegEx.test(value)) {
        return true;
    }
    return false;
}

function isDateTime(value){
    var dateTimeRegEx = new...