JSFiddle - React, Tailwind, and code Playground

by timrwood

HTML

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

CSS

p {
    margin: 20px;
    padding: 10px;
    background: #eee;
    color: #666;
    font-family: Helvetica, Arial, sans-serif;
}

JavaScript

function print(a) {
    $('body').append('<p>' + a + '</p>');
}

moment.fn.daysInMonth2 = function () {
    var next_month = this.clone().date(1).month(this.month() + 1);
    print('debug: ' + next_month.format());
    print('month: ' + this.month());
    print('clone month: ' + this.clone().month());
    print('next month: ' + next_month.month());
    return next_month.date(0).date();
}

print(moment([2012, 0, 31]).daysInMonth());
print(moment([2012, 0, 31]).daysInMonth2());