OK, thank you for the information! On Wed, Oct 20, 2010 at 9:17 AM, AD7six <andydawso...@gmail.com> wrote: > > > On Oct 20, 12:56 am, cricket <zijn.digi...@gmail.com> wrote: >> On Tue, Oct 19, 2010 at 6:02 AM, psybear83 <psybea...@gmail.com> wrote: >> > Hi everybody >> >> > Is there a reason why CakePHP doesn't recognize dates before >> > 1600-01-01? I get a validation error when submitting a date before >> > that (e.g. 1599-31-12 or 1300-11-05). >> >> Use the source, Luke.http://api.cakephp.org/view_source/validation/#line-389 >> >> --snip-- >> $regex['ymd'] = >> '%^(?:(?:(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?: >> 16|[2468][048]|[3579][26])00)))(\\/|-|\\.|\\x20)(?:0?2\\1(?:29)))|(?:(?:(?: >> 1[6-9]|[2-9]\\d)?\\d{2})(\\/|-|\\.|\\x20)(?:(?:(?:0?[13578]|1[02])\\2(?:31) >> )|(?:(?:0?[1,3-9]|1[0-2])\\2(29|30))|(?:(?:0?[1-9])|(?:1[0-2]))\\2(?:0?[1-9 >> ]|1\\d|2[0-8]))))$%'; >> --snip-- >> >> Note the "1[6-9]|[2-9]". I believe that's saying, "(1 AND 6-9) OR (1 >> AND 2-9), which wouldn't be desirable. > > You're misreading that bit of the regex, the OR applies to the group > > i.e. > 1[6-9] or [2-9]\d > or in other words: > 16-19 or 20 - 99 > > But the answers' pretty simple, if the validation doesn't suit your > needs - just use a different regex. The one in the core is quite > complex to cope with lots of possibilities, just look at the test > case: > http://github.com/cakephp/cakephp/blob/master/cake/tests/cases/libs/validation.test.php#L1037 > > If you /really/ need dates in the far past, or simply anything that > mysql will accept just use \d{4}-\d{2}-\d{2} - in it's simplest form > (iirc, mysql accepts almost anything in this format as a date - since > it's stored as a string). > > hth, > > AD > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en >
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en