mgcrea/angular-strap — pull request #640 by bloveridge (2014-04-04 22:26:25+00:00)
Title: Dateparser regex fixes

Several date-parser regular expressions don't work as expected. What caused me to notice this was that I was using a datePicker with format `M/d/yy`, which would correctly display today's date as "4/5/15" in my input field. But when I entered the same value into the input field manually (as opposed to select an item in the date picker) the input field would mark date as `$invalid` on my form object -- though it *would* validate if I typed "04/05/15" -- which is actually `MM/dd/yy` format or, as I discovered while investigating the problem, the default non-strict behavior of `M/d/yy`. While it's great that 0-prefixed values are supported even when using a single-digit format, the single-digit variant should also work as expected :)

Several other formats were also not functioning as expected. Here's a list of the errors I found and fixed:

##### single-digit year (y)
* was nowhere near as permissive as the Date API supports, or as Angular itself
* negative years were not supported
* year 0 was not supported
* 3- and 4-digit years like 199 were not supported (this specific example is used in the Angular docs), 2014, etc.
* basically, this only worked with 2-digit years greater than year 09

##### single-digit month (M)
* with `strict=false`, single-digit months like `1` were not supported — they had to be `01` which is specifically *not* single-digit

##### single-digit date (d)
* with `strict=true`, both `0` and `00` were considered valid (`0` is an invalid date, and `00` isn’t even single-digit)
* with `strict=false`, single-digit values like `1` were not supported (same as `M` case above)

##### double-digit date (dd)
* `00` was considered valid (there is no date 0 in a month)

##### single-digit hour, 24-hour clock (H)
* with `strict=true`, only the hours 1-12 were supported (13-23 should be supported)
* single-digit values like `0` and `1` were not supported at all
* with `strict=false`, 0-prefix should be optional but not required
* with `strict=true`, 0-prefix should be forbidden
* thus with `strict=true`, double-digit values like `01` and `09` were supported but should not be

##### single-digit minute (m)
* with `strict=false`, single-digit values like `0` and `1` should be supported (0-prefix should be *supported* when not strict, but should not be *required*)

##### single-digit second (s)
* with `strict=false`, single-digit values like `0` and `1` should be supported (0-prefix should be *supported* when not strict, but should not be *required*)