• Firstington (unregistered)

    Ensimmäinen!

  • Bogolese (unregistered)

    Feb. 31, Eleventy-Eleven is okay?

  • F (unregistered)

    "Unfortunately that number was one"

    You were fortunate that the number was greater than zero.

  • justsomedudette (unregistered)

    How did anyone sign up when yearOK never gets set to true?

  • David (unregistered)

    Some people just don't think through this stuff. How many people of the marketing department actually registered on the site?

  • Ozz (unregistered) in reply to justsomedudette
    justsomedudette:
    How did anyone sign up when yearOK never gets set to true?
    It does.
  • justsomedudette (unregistered) in reply to Ozz
    Ozz:
    justsomedudette:
    How did anyone sign up when yearOK never gets set to true?
    It does.
    Ah my mistake I stupidly assumed that a variable that is checked for a value would change somewhere, so I read that as false. Nevermind, I'm sure the programmer had a really good reason to create it!
  • L. (unregistered) in reply to David

    I'm pretty sure they wouldn't realize how f*cking annoying their brilliant questionnaire is to anyone who doesn't give a damn about it.

    Quite interesting that anyone would be considered qualified for sales duty and still not understand the customer's perspective -- yet another proof they didn't need good coders anyway ;)

  • guy (unregistered)

    @justsomedudette: it gets initialized to true.

    Which is rather amusing, though I believe they could have verified the years, too. Using a code generator.

    Captcha: praesent - i made u print "if (" + " || ".join([str(o) for o in range(2011)]) + ")" as a praesent.

  • 'Murruhkan (unregistered)

    Anyone else catch that the day and month if() statements checked twice to see if the value was 10?

  • guy (unregistered) in reply to guy

    print "if (year == " + " || year == ".join([str(o) for o in range(2011)]) + ")"

    captcha: plaga - i have the brain plaga today

  • Merphle (unregistered)

    So what happens when I try to sign up with my birthdate of:

    1/1/'; drop database; --

  • Fred Flintstone (unregistered) in reply to justsomedudette
    justsomedudette:
    Ozz:
    justsomedudette:
    How did anyone sign up when yearOK never gets set to true?
    It does.
    Ah my mistake I stupidly assumed that a variable that is checked for a value would change somewhere, so I read that as false. Nevermind, I'm sure the programmer had a really good reason to create it!

    correct me if I am wrong but would 7/14/aa be a valid date?

  • E (unregistered) in reply to Firstington

    Miks kaikki on aina ihan "FRIST1!1!!"

  • Kpsok (unregistered) in reply to justsomedudette

    yearOK is always true : [code] var dayOk; var monthOk; var yearOk;

    dateOk = false; monthOk = false; yearOk = true;[/code}

  • Rajendra Kumar (unregistered)

    Dearest Mr. Mark Steyn,

    Thanks you so very much for posting this validation code. I am in need of such for the finnishing touches on my time, date and calendar application. However I have doubts because when I am making reuse of this code I geterrors. Could you PLEASE repost this code so it works for Java EE 6? I am under such urgent deadline.

  • The Nerve (unregistered)

    Fixed?

    if (month == "1" || month == "2" || month == "3" || month == "4" || month == "5" || 
          month == "6" || month == "7" || month == "8" || month == "9" || month == "10" || 
          month == "01" || month == "02" || month == "03" || month == "04" || month == "05" || 
          month == "06" || month == "07" || month == "08" || month == "09" || month == "10" || 
          month == "11" || month == "12" ||
          month == "Jan" || month == "Feb" || month == "Mar" || month == "Apr" || month == "May" || 
          month == "Jun" || month == "Jul" || month == "Aug" || month == "Oct" || month == "Nov" || 
          month == "Dec") {
        monthOk = true;
      }
    
  • Some damn Yank (unregistered) in reply to Merphle
    Merphle:
    So what happens when I try to sign up with my birthdate of:

    1/1/'; drop database; --

    That's fine. yearOk is still true in that case.

    Captcha: incassum. The total number if incas.

  • Nagesh (unregistered) in reply to Rajendra Kumar
    Rajendra Kumar:
    Dearest Mr. Mark Steyn,

    Thanks you so very much for posting this validation code. I am in need of such for the finnishing touches on my time, date and calendar application. However I have doubts because when I am making reuse of this code I geterrors. Could you PLEASE repost this code so it works for Java EE 6? I am under such urgent deadline.

    Helping you, mine asteemd coleague!

    sed 's/function/public String/' sed 's/var/String/'

    Much happiness reguards to be completing deadline!

  • airdrik (unregistered)

    But each month has different numbers of days:

    if (((month == "1" || month == "01") && 
         (day == "1" || day == "2" || day == "3" || day == "4" || day == "5" || 
          day == "6" || day == "7" || day == "8" || day == "9" || day == "10" ||
          day == "01" || day == "02" || day == "03" || day == "04" || day == "05" || 
          day == "06" || day == "07" || day == "08" || day == "09" || day == "10" || 
          day == "11" || day == "12" || day == "13" || day == "14" || day == "15" || 
          day == "16" || day == "17" || day == "18" || day == "19" || day == "20" || 
          day == "21" || day == "22" || day == "23" || day == "24" || day == "25" || 
          day == "26" || day == "27" || day == "27" || day == "29" || day == "30" || 
          day == "31")) ||
    ((month == "2" || month == "02") && 
         (day == "1" || day == "2" || day == "3" || day == "4" || day == "5" || 
          day == "6" || day == "7" || day == "8" || day == "9" || day == "10" ||
          day == "01" || day == "02" || day == "03" || day == "04" || day == "05" || 
          day == "06" || day == "07" || day == "08" || day == "09" || day == "10" || 
          day == "11" || day == "12" || day == "13" || day == "14" || day == "15" || 
          day == "16" || day == "17" || day == "18" || day == "19" || day == "20" || 
          day == "21" || day == "22" || day == "23" || day == "24" || day == "25" || 
          day == "26" || day == "27" || day == "28" || day == "29") ||
    ((month == "3" || month == "03") && 
         (day == "1" || day == "2" || day == "3" || day == "4" || day == "5" || 
          day == "6" || day == "7" || day == "8" || day == "9" || day == "10" ||
          day == "01" || day == "02" || day == "03" || day == "04" || day == "05" || 
          day == "06" || day == "07" || day == "08" || day == "09" || day == "10" || 
          day == "11" || day == "12" || day == "13" || day == "14" || day == "15" || 
          day == "16" || day == "17" || day == "18" || day == "19" || day == "20" || 
          day == "21" || day == "22" || day == "23" || day == "24" || day == "25" || 
          day == "26" || day == "27" || day == "27" || day == "29" || day == "30" || 
          day == "31")) ||
    ...
     {
        dayOk = true;
      }
    
    
  • Nagesh (unregistered) in reply to Nagesh
    Nagesh:
    Rajendra Kumar:
    Dearest Mr. Mark Steyn,

    Thanks you so very much for posting this validation code. I am in need of such for the finnishing touches on my time, date and calendar application. However I have doubts because when I am making reuse of this code I geterrors. Could you PLEASE repost this code so it works for Java EE 6? I am under such urgent deadline.

    Helping you, mine asteemd coleague!

    sed 's/function/public String/' sed 's/var/String/'

    Much happiness reguards to be completing deadline!

    But I am also forgetting to be this:

    sed 's/true/"true"' sed 's/false/"false"'

  • JJ (unregistered) in reply to The Nerve
    The Nerve:
    Fixed?
    if (month == "1" || month == "2" || month == "3" || month == "4" || month == "5" || 
          month == "6" || month == "7" || month == "8" || month == "9" || month == "10" || 
          month == "01" || month == "02" || month == "03" || month == "04" || month == "05" || 
          month == "06" || month == "07" || month == "08" || month == "09" || month == "10" || 
          month == "11" || month == "12" ||
          month == "Jan" || month == "Feb" || month == "Mar" || month == "Apr" || month == "May" || 
          month == "Jun" || month == "Jul" || month == "Aug" || month == "Oct" || month == "Nov" || 
          month == "Dec") {
        monthOk = true;
      }
    
    if (month == "1" || month == "2" || month == "3" || month == "4" || month == "5" || 
          month == "6" || month == "7" || month == "8" || month == "9" || month == "10" || 
          month == "01" || month == "02" || month == "03" || month == "04" || month == "05" || 
          month == "06" || month == "07" || month == "08" || month == "09" || month == "10" || 
          month == "11" || month == "12" ||
          month == "Jan" || month == "Feb" || month == "Mar" || month == "Apr" || month == "May" || 
          month == "Jun" || month == "Jul" || month == "Aug" || month == "Aug" || month == "Oct" ||
          month == "Nov" || month == "Dec") {
        monthOk = true;
      }
    
    Fixed.
  • (cs)

    "Curiously fewer people signed up for the site that the marketing department anticipated..."

    Than. THAN!

  • (cs)

    Verify ALL the DOBs!

  • frist post (unregistered)

    My favorite part is where they put "10" in each list twice.

  • (cs) in reply to Zylon
    Zylon:
    "Curiously fewer people signed up for the site that the marketing department anticipated..."

    Than. THAN!

    What I like about you is that you're so much smarter than ALL the people around you.

  • Ibix (unregistered) in reply to frist post
    frist post:
    My favorite part is where they put "10" in each list twice.
    It's a joke in binary.
  • bytepirate (unregistered) in reply to airdrik
    airdrik:
    But each month has different numbers of days:

    ((month == "2" || month == "02") && (day == "1" || day == "2" || day == "3" || day == "4" || day == "5" || day == "6" || day == "7" || day == "8" || day == "9" || day == "10" || day == "01" || day == "02" || day == "03" || day == "04" || day == "05" || day == "06" || day == "07" || day == "08" || day == "09" || day == "10" || day == "11" || day == "12" || day == "13" || day == "14" || day == "15" || day == "16" || day == "17" || day == "18" || day == "19" || day == "20" || day == "21" || day == "22" || day == "23" || day == "24" || day == "25" || day == "26" || day == "27" || day == "28" || day == "29") || ((month == "3" || month == "03") && ... { dayOk = true; }

    c'mon you can do better than that...

          day == "26" || day == "27" || day == "28" || (day == "29" && (year==2012 || year==2008 || year==2004 || year==2000
    ...
    ))
    
    ) ||
    ((month == "3" || month == "03") && 
    ...
    
  • Bananas (unregistered) in reply to airdrik
    airdrik:
    But each month has different numbers of days:
    if (((month == "1" || month == "01") && 
         (day == "1" || day == "2" || day == "3" || day == "4" || day == "5" || 
          day == "6" || day == "7" || day == "8" || day == "9" || day == "10" ||
          day == "01" || day == "02" || day == "03" || day == "04" || day == "05" || 
          day == "06" || day == "07" || day == "08" || day == "09" || day == "10" || 
          day == "11" || day == "12" || day == "13" || day == "14" || day == "15" || 
          day == "16" || day == "17" || day == "18" || day == "19" || day == "20" || 
          day == "21" || day == "22" || day == "23" || day == "24" || day == "25" || 
          day == "26" || day == "27" || day == "27" || day == "29" || day == "30" || 
          day == "31")) ||
    ((month == "2" || month == "02") &&
    
    ...snip...

    Just why are you here, anyway?

  • airdrik (unregistered) in reply to bytepirate
    bytepirate:
    airdrik:
    But each month has different numbers of days:

    ((month == "2" || month == "02") && (day == "1" || day == "2" || day == "3" || day == "4" || day == "5" || day == "6" || day == "7" || day == "8" || day == "9" || day == "10" || day == "01" || day == "02" || day == "03" || day == "04" || day == "05" || day == "06" || day == "07" || day == "08" || day == "09" || day == "10" || day == "11" || day == "12" || day == "13" || day == "14" || day == "15" || day == "16" || day == "17" || day == "18" || day == "19" || day == "20" || day == "21" || day == "22" || day == "23" || day == "24" || day == "25" || day == "26" || day == "27" || day == "28" || day == "29") || ((month == "3" || month == "03") && ... { dayOk = true; }

    c'mon you can do better than that...

          day == "26" || day == "27" || day == "28" || (day == "29" && (year==2012 || year==2008 || year==2004 || year==2000
    ...
    ))
    
    ) ||
    ((month == "3" || month == "03") && 
    ...
    

    Yeah, I could have done that but nobody complained and it wasn't on the bug report.

  • (cs)

    Well, it's a well-known fact that it's difficult for JavaScript™ programmers to get dates.

  • (cs) in reply to derula
    derula:
    Verify ALL the DOBs!

    Yeah, what they SHOULD be doing is triggering a daily printout containing a list of all users who attempted to log in; every night they should then send out a representative to each of these users' locations to examine the users' drivers' licenses to make sure the DOB is actually correct! You can't just have people making up dates without verifying them, you know!

  • Rnd( (unregistered)

    What about 28th day? Yeah, still I like how I can choose year like Year of Fruitbat

  • revenant (unregistered)

    Why not just store all valid dates in a database on a special date-checking server, and query it from their javascript function? So much better, and easier to update if our calendar system changes suddenly.

  • Wonk (unregistered) in reply to Rnd(
    Rnd(:
    What about 28th day? Yeah, still I like how I can choose year like Year of Fruitbat

    It's part of their internationalization campaign. They are already ready for Chinese years.

  • SeySayux (unregistered)

    Hmm... A challenge. Implement DD/MM/YYYY sanity checks with as few WTFs and as much esoteric features as possible...

    bool checkDate(String date) {
        (Array<String> p = date.split({"/"})).length == 3 or return false;
    
        short year = p[2].length() == 2 ? (short ylp = (short)p[2] < (short cymh = (short cyr = GregorianCalendar(Date()).year) % 100) ? (short cen = cyr-cymh)+ylp : (cen-1)*100 + ylp : p[2].length() == 4 ? (short)p[2] : 0;
        year or return year;
    
        foreach(byte i, {0,1}) {
           p[i].length inr(1,2) or return 0;
        }
        byte day = (short)p[0];
        byte month = (short)p[1];
    
        (month <= 12 and month) or return false;
    
        if(month ina(1,3,5,7,8,10,12)) {
            (day <= 31 and day) or return false;
        } else if(month ina(4,6,9,11)) {
            (day <= 30 and day) or return false;
        } else {
            return (year%400||year%4&&!year%100)?(day <=29 and day) : (day <= 28 and day);
        }
    
        return true;
    }
  • Rnd( (unregistered) in reply to Fred Flintstone
    Fred Flintstone:
    justsomedudette:
    Ozz:
    justsomedudette:
    How did anyone sign up when yearOK never gets set to true?
    It does.
    Ah my mistake I stupidly assumed that a variable that is checked for a value would change somewhere, so I read that as false. Nevermind, I'm sure the programmer had a really good reason to create it!

    correct me if I am wrong but would 7/14/aa be a valid date?

    Nope, there is no 14th month. Atleast it uses almost sensible format dd/mm/str

  • n_slash_a (unregistered) in reply to Rnd(
    Rnd(:
    Fred Flintstone:
    justsomedudette:
    Ozz:
    justsomedudette:
    How did anyone sign up when yearOK never gets set to true?
    It does.
    Ah my mistake I stupidly assumed that a variable that is checked for a value would change somewhere, so I read that as false. Nevermind, I'm sure the programmer had a really good reason to create it!

    correct me if I am wrong but would 7/14/aa be a valid date?

    Nope, there is no 14th month. Atleast it uses almost sensible format dd/mm/str

    Finally, a site where I can correctly enter my birthday of 31/02/apple

  • (cs)

    Thirty questions, hmmm? It was probably the ones about the location of the hideout key and the in-house safe that scared everyone off.

  • (cs) in reply to David
    David:
    Some people just don't think through this stuff. How many people of the marketing department actually registered on the site?

    None of them, of course. ("I'm not answering all those snoopy questions.")

    I realize that sounds pretty brain-dead, but then most of marketing seems to be brain-dead. Witness The Great Google Banner Ad Conspiracy.

  • a flaming pineapple (unregistered)

    wouldn't this throw a javascript error for defining "var dateOkay" twice? or is that a typo when you declare it globally before actually declaring it?

  • (cs) in reply to derula
    derula:
    What I like about you is that you're so much smarter than ALL the people around you.
    What a coincidence, that's what I like about myself too.
  • Caerphoto (unregistered) in reply to a flaming pineapple
    a flaming pineapple:
    wouldn't this throw a javascript error for defining "var dateOkay" twice? or is that a typo when you declare it globally before actually declaring it?
    JS is fine about declaring variables multiple times, plus when it's actually executed the declarations are moved internally to the top of their scope anyway.

    wisi: or do wi?

  • (cs) in reply to Sock Puppet 5
    Sock Puppet 5:
    Well, it's a well-known fact that it's difficult for programmers to get dates.
    FTFY
  • m (unregistered) in reply to guy
    guy:
    …though I believe they could have verified the years, too. Using a code generator.

    Nah, you don’t need no code generator to verify the year. We successfully used the following in production for almost 10 years:

      'verify current date
      If Val(Format$(Now(), "yyyy")) > 2020 Then
        Date = DateValue("01.01.2000")
      End If
  • F (unregistered) in reply to E

    No miksei olisi?

  • Fred (unregistered)

    I think the coder should get points for thinking about the leap year case. Obviously, on non-leap years, you can't have a birthday on the 28th because that would be the 29th on a leap year. right?

  • Don (unregistered) in reply to Merphle

    We call him Little Bobby Tables

  • Don (unregistered) in reply to Merphle
    Merphle:
    So what happens when I try to sign up with my birthdate of:

    1/1/'; drop database; --

    Then we call you Little Bobby Tables.

  • Frederik Van Bogaert (unregistered) in reply to guy
    guy:
    Which is rather amusing, though I believe they could have verified the years, too. Using a code generator.

    Captcha: praesent - i made u print "if (" + " || ".join([str(o) for o in range(2011)]) + ")" as a praesent.

    Code generator, code schmenegator. Javascript has an eval() function, you know!

    Captcha: saepius -- the original coder obviously wasn't very saepient

Leave a comment on “Verify[most]DOB()”

Log In or post as a guest

Replying to comment #:

« Return to Article