EUCOOKIELAW_BANNER_TITLE

  • I think that

    Making the Web is like playing a game. Standard, Accessibility and Usability are only few rules.
    No game is awesome if you don't follow the rules.

    International Webmasters Association

  • Subscribe to my blog via email

    Insert here your e-mail address and you will receive a message when a new post will come.

6 thoughts on “Howto detect if typed date is valid

  1. Riddle: catch the bug.

    isValidDate('30/08/2012', '/', 'dmy') == true
    isValidDate('29/02/2000', '/', 'dmy') == true
    isValidDate('10/10/1580', '/', 'dmy') == true
    isValidDate('29/02/2001', '/', 'dmy') == false
    isValidDate('10/10/1582', '/', 'dmy') == true
    isValidDate('10/12/2121', '/', 'dmy') == true
    isValidDate('10/10/2000', '/', 'dmy') == true
    

    where is the function lack?

    • Hi Giacomo,
      trying the following code:

      Hi Giacomo,
      trying the following code:

      var_dump(validaData('30/08/2012', '/', 'dmy')); # bool(true)
      var_dump(validaData('29/02/2000', '/', 'dmy')); # bool(true)
      var_dump(validaData('10/10/1580', '/', 'dmy')); # bool(true)
      var_dump(validaData('29/02/2001', '/', 'dmy')); # bool(false)
      var_dump(validaData('10/10/1582', '/', 'dmy')); # bool(true)
      var_dump(validaData('10/12/2121', '/', 'dmy')); # bool(true)
      var_dump(validaData('10/10/2000', '/', 'dmy')); # bool(true) 
      

      the output is as expected. So… where is the bug? :)

  2. no, it wasn’t!
    the day after 4th october, was 15th october, according to Gregorian calendar.

    ….but ….

    …but…. there are many consideration we could do. (i.e. Swedish Reign used Giulian (Assange) calendar till 1699)