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

new Date("wtf")

jsdate.wtf

external-link
message-square
23
link
fedilink
  • cross-posted to:
  • [email protected]
  • [email protected]
61
external-link

new Date("wtf")

jsdate.wtf

Sheldan@programming.dev to Programming@programming.dev · 7 months ago
message-square
23
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
    ·
    7 months 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
      ·
      7 months 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
      ·
      7 months 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
    ·
    7 months ago

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

  • hperrin@lemmy.ca
    link
    fedilink
    English
    arrow-up
    5
    ·
    7 months 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
    ·
    7 months 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
    ·
    7 months 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 😑

  • brb@sh.itjust.works
    link
    fedilink
    arrow-up
    3
    ·
    7 months ago

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

    Aight I’m out

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

        Same. I think I got one on accident too.

  • humanspiral@lemmy.ca
    link
    fedilink
    arrow-up
    2
    ·
    7 months ago

    Can we sue Oracle back for any of this?

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

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

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

  • Xylight‮@lemdro.id
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    7 months ago

    deleted by creator

  • catalyst@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    7 months ago

    It only took one question for me to start wanting to flip tables.

  • Mr. Satan@lemmy.zip
    link
    fedilink
    arrow-up
    1
    ·
    7 months ago

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

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.

  • 272 users / day
  • 1.03K users / week
  • 3.17K users / month
  • 7.78K users / 6 months
  • 1 local subscriber
  • 24.9K subscribers
  • 950 Posts
  • 9.68K Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Ategon@programming.dev
  • MaungaHikoi@lemmy.nz
  • UlrikHD@programming.dev
  • BE: 0.19.15
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org