Somewhat silly code to prevent errors parsing dates like 2014-05 on days whose numbers are greater than those the given month can support