JSFiddle - React, Tailwind, and code Playground

by ravimallya

HTML

<input id="datePick" type="text" />

JavaScript

/*
 * MultiDatesPicker v1.6.1
 * http://multidatespickr.sourceforge.net/
 * 
 * Copyright 2011, Luca Lauretta
 * Dual licensed under the MIT or GPL version 2 licenses.
 */
(function ($) {
    $.extend($.ui, {
        multiDatesPicker: {
            version: "1.6.1"
        }
    });

    $.fn.multiDatesPicker = function (method) {
        var mdp_arguments = arguments;
        var ret = this;
        var today_date = new Date();
        var day_zero = new Date(0);
        var mdp_events = {};

        function removeDate(date, type) {
            if (!type) type = 'picked';
            date = dateConvert.call(this, date);
            for (var i in this.multiDatesPicker.dates[type])
            if (!methods.compareDates(this.multiDatesPicker.dates[type][i], date)) return this.multiDatesPicker.dates[type].splice(i, 1).pop();
        }

        function removeIndex(index, type) {
            if (!type) type = 'picked';
            return this.multiDatesPicker.dates[type].splice(index, 1).pop();
        }

        function addDate(date, type, no_sort) {
            if (!type) type = 'picked';
            date = dateConvert.call(this, date);

            // @todo: use jQuery UI datepicker method instead
            date.setHours(0);
            date.setMinutes(0);
            date.setSeconds(0);
            date.setMilliseconds(0);

            if (methods.gotDate.call(this, date, type) === false) {
                this.multiDatesPicker.dates[type].push(date);
                if (!no_sort) this.multiDatesPicker.dates[type].sort(methods.compareDates);
            }
        }

        function sortDates(type) {
            if (!type) type = 'picked';
            this.multiDatesPicker.dates[type].sort(methods.compareDates);
        }

        function dateConvert(date, desired_type, date_format) {
            if (!desired_type) desired_type = 'object';
            /*
			if(!date_format && (typeof date == 'string')) {
				date_format = $(this).datepicker('option',...