Boing Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Sheldan@programming.dev to Programming@programming.dev · 24 days ago

new Date("wtf")

jsdate.wtf

external-link
message-square
16
link
fedilink
  • cross-posted to:
  • [email protected]
  • [email protected]
59
external-link

new Date("wtf")

jsdate.wtf

Sheldan@programming.dev to Programming@programming.dev · 24 days ago
message-square
16
link
fedilink
  • cross-posted to:
  • [email protected]
  • [email protected]
How well do you know JavaScript's Date class?
alert-triangle
You must log in or # to comment.
  • bleistift2@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    14
    ·
    24 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!

    • Tanoh@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      24 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.

    • Hotzilla@sopuli.xyz
      link
      fedilink
      arrow-up
      1
      ·
      24 days ago

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

  • ragingHungryPanda@lemmy.zip
    link
    fedilink
    arrow-up
    8
    ·
    24 days ago

    I got 10/28, but I was crying after the 7th question

  • hperrin@lemmy.ca
    link
    fedilink
    English
    arrow-up
    5
    ·
    24 days ago

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

    Oof. I’ve been a JS dev since 1998.

  • mesa@piefed.social
    link
    fedilink
    English
    arrow-up
    4
    ·
    24 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.

  • DrWorm@piefed.social
    link
    fedilink
    English
    arrow-up
    4
    ·
    24 days ago

    The quirks in this quiz aren’t even universal, and vary based on which browser you’re using. See the table at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse#non-standard_date_strings

    Also I got 13/28 😑

  • anton@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    3
    ·
    24 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
      1
      ·
      24 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
        2
        ·
        24 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.

      • mesa@piefed.social
        link
        fedilink
        English
        arrow-up
        1
        ·
        24 days ago

        Same. I think I got one on accident too.

  • Macallan@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    24 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)

  • brb@sh.itjust.works
    link
    fedilink
    arrow-up
    2
    ·
    23 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
    2
    ·
    23 days ago

    Can we sue Oracle back for any of this?

  • Xylight@lemdro.id
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    15 days ago

    deleted by creator

  • tleb@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    24 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

  • Thinker@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    24 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.

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 254 users / day
  • 1.52K users / week
  • 3.12K users / month
  • 5.66K users / 6 months
  • 1 local subscriber
  • 22K subscribers
  • 364 Posts
  • 3.69K Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Ategon@programming.dev
  • MaungaHikoi@lemmy.nz
  • UlrikHD@programming.dev
  • BE: 0.19.12
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org