• brb@sh.itjust.works
    link
    fedilink
    arrow-up
    0
    ·
    14 days ago

    Except for some reason “2” is interpreted as a month, and the year is set to 2001.

    Aight I’m out

    • humanspiral@lemmy.ca
      link
      fedilink
      arrow-up
      0
      ·
      13 days ago

      “12.1” is interpreted as the date December 1st, and as before for dates with no year the default is 2001 because of course.

      it gets better and more coherent the deeper you go :P

  • Xylight@lemdro.id
    link
    fedilink
    English
    arrow-up
    0
    ·
    14 days ago

    I don’t like calling myself a JS/TS dev but my biggest project that I currently work on is written in it, so I had to try it.

    16/28. I mean it’s incredible how I can throw a diabolical amount of variations of formatting at it and somehow get valid dates.

  • anton@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    0
    ·
    14 days ago

    Great quiz. It teaches you the rules while training you to expect the unexpected, even in the rare cases that the rules are applied consistently.
    I got exactly half the questions right.

    • salmoura@lemmy.eco.br
      link
      fedilink
      arrow-up
      0
      ·
      14 days ago

      I scored 8/28 on https://jsdate.wtf/ and all I got was this lousy text to share on social media.

      don't tap for spoilers

      The sequence of questions about new Date(“0”), new Date(“1”), and new Date(“2”) got me good.

      • bamboo@lemmy.blahaj.zone
        link
        fedilink
        English
        arrow-up
        0
        ·
        14 days ago

        That was so funny, I had to pause taking the quiz I was laughing so hard at question 9. The snark in the explanations is fantastic.

  • bleistift2@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    0
    ·
    15 days ago

    I am a frontend dev. JavaScript (well, TypeScript) is my bread and butter. Even knowing its quirks I never would have thought how inconsistent Date actually is. I encourage everyone to try this quiz.

    This is what JavaScript haters should bring forth, not 0.1 + 0.2 !== 0.3!

    • Hotzilla@sopuli.xyz
      link
      fedilink
      arrow-up
      0
      ·
      14 days ago

      Floating point rounding issues are basic comp science issues. Hopefully nobody thinks that those are JavaScript quirks.

    • Tanoh@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      14 days ago

      There is a reason almost everyone use some Date lib, like Luxon and not the built in. And well, having a horrible built in lib that they can’t change due to legacy code breaking is nothing really new or unique to JS.

      • bleistift2@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        0
        ·
        13 days ago

        The built-in lib is fine for basic stuff unless you do some crazy shit like expecting "2" to parse as a valid date.

        • Tanoh@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          13 days ago

          For very basic things maybe, but it has a lot of other weird problems and restrictions. Mutability, no real timezone support, very limited arithmetic, to name a few. As soon as you move beyond the very basic, you want someting more robust.

    • dalekcaan@feddit.nl
      link
      fedilink
      arrow-up
      0
      ·
      13 days ago

      Or the ones where people point out how inconsistent JS is with adding strings to numbers.

      Yeah, maybe don’t do arithmetic on numbers as strings?

  • Macallan@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    14 days ago

    I got a 4/28 and got told I would have scored higher if I guessed at random. Ouch. (I am not a dev)

    • Ephera@lemmy.ml
      link
      fedilink
      English
      arrow-up
      0
      ·
      14 days ago

      I mean, for what it’s worth, I’m a seasoned dev and just did a run where I tried to answer everything as it makes sense to me (which is “throws an error” or “invalid date” for all of them) and I also got a score of 4/28.

      …and two of those points were given to me, because the quiz interpreted my answer differently than I meant it.

      In other words, this quiz exists to highlight that JavaScript’s Date functions make no sense.

  • mesa@piefed.social
    link
    fedilink
    English
    arrow-up
    0
    ·
    14 days ago

    I did not do well:

    “I scored 9/28 on https://jsdate.wtf/ and all I got was this lousy text to share on social media.”

    Ive been a dev for a long time. Im glad im not doing javascript all that much anymore.

      • humanspiral@lemmy.ca
        link
        fedilink
        arrow-up
        0
        ·
        13 days ago

        They ended up with Javascript trademark (afaik, because the name was too close to Java) too. Sued node.js over something related.

        • BatmanAoD@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          13 days ago

          Apparently the JS name was selected and announced in partnership with Sun from the very beginning, and Sun had the copyright over both Java and JapaScript up until the acquisition by Oracle. I had no idea, but that makes perfect sense.

  • tleb@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    14 days ago

    I scored 17/28 on https://jsdate.wtf/ and all I got was this lousy text to share on social media.

    Idk anything about Date but got pretty far with intuition of JS whackiness

  • lunarul@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    14 days ago

    If you’re not very familiar with JS, watch the Wat talk before taking the quiz to know what to expect from this wonderful language.

  • Thinker@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    14 days ago

    Thank god Temporal is finally in Stage 3, and already rolled out in Firefox. I can’t wait to be done with JS’s Date forever.

  • schnurrito@discuss.tchncs.de
    link
    fedilink
    arrow-up
    0
    ·
    14 days ago

    7/28. Of course no one would ever do most of those things, they are interesting to think about but with little practical use.