6 risposte su “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?

    1. 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)

I commenti sono chiusi

%d blogger hanno fatto clic su Mi Piace per questo: