alphagov/whitehall — pull request #1691 by fofr (2014-08-29 11:36:55+00:00)
Title: Stop incorrect date initialisation at month end

Bug manifested as a failing test on Aug 29, the tests use February as an example. The JavaScript was creating a date, using today, then going through and setting each of the properties, eg year, month etc. On August 29, setting the month to February would try and create a date “February 29” (non-leap year) which is not a valid date, so JavaScript switches the month to March.

* Avoid bug by creating variables from each date input then creating a date all at once

![screen shot 2014-08-29 at 12 30 08](https://cloud.githubusercontent.com/assets/319055/4089664/74450e80-2f70-11e4-89c5-2b1d87c2d99f.png)