JSFiddle - React, Tailwind, and code Playground

by Stormjack

HTML

Month: <input type="text" id="txtMonth" value="7" /><br/>
Year: <input type="text" id="txtYear" value="2017" /><br/>
<input type="button" id="btnGo" value="Go" />

JavaScript

$(function () {
    $('#btnGo').click(function () {
        var month = $('#txtMonth').val();
        var year = $('#txtYear').val();
        var expires = new Date(year, month, 0);
        var expires2 = new Date(year, month); 
        alert(expires);  // Show end of month day.
        alert(expires2); // Show first day of next month
    });
});