mcv 2 days ago

I'm not sure if I should be pleased or embarrassed about my 17/28. Why do I even know this?

My son was pretty happy with his 11/28 without any experience with js Date. Just deduced it from previous answers. And I explained type coercion to him.

I now realize I may have put him off a career in IT.

  • corey_moncure 2 days ago

    Javascript put me off a career in IT for 20 years, and even today I still avoid it like radioactive waste.

samwho 2 days ago

It very much is. I put the lil notice at the start that I verified the questions on a specific version of Node, with a specific timezone, because both things matter.

  • zinekeller 2 days ago

    Some notes that I have noticed. First, why does it seem that the V8 date parser is heavily inspired by the Windows date parser (https://devblogs.microsoft.com/oldnewthing/20200304-00/?p=10...)? EDIT: Apparently not, "new Date('Savvyday 29 Oatmeal 94')" is invalid both in Firefox and Chrome.

    Second, I opened this in Firefox with the console open to answer these questions, and found these divergences (to summarize, Firefox is strict):

    Question 14:

      new Date("12.1")
    
    > "12.1" is interpreted as the date December 1st, and as before for dates with no year the default is 2001 because of course.

    Firefox returns an Invalid Date object instead.

    Question 16:

      new Date("12.-1")
    
    > The dash here is ignored, so this is interpreted the same as "12.1".

    Again, Firefox returns an Invalid Date object instead.

    Question 19:

      new Date("maybe 1")
    
    > "may" in "maybe" is parsed as the month May! And for some reason this expression cares about your local timezone, which happens to be BST for me right now.

    Seems a broken record, but this is still an Invalid Date for Firefox.

    Question 20:

      new Date("fourth of may 2010")
    
    > "fourth of" is ignored, this is just parsing "may 2010" and again local timezone is important.

    Ibid in Firefox.

    Question 21:

      new Date("May 4 UTC")
    
    > UTC is correctly parsed as a timezone.

    No, Firefox is still not accepting this one.

    Question 22:

      new Date("May 4 UTC+1")
    
    > You can add modifiers to timezones and it works as you would expect.

    Neither this one.

    Question 23:

      new Date("May 4 UTC+1:59")
    
    > It also supports minutes!

    Firefox: Not really.

    Final note: It parses Question 24 as you expect in Firefox. Which honestly, it shouldn't!

    • mnahkies 2 days ago

      It's probably improved the past 8 years or so, but I remember Safari was particularly bad for bugs around DST and just dates in general back then, even when using valid input.

      We ended up with a bunch of Safari specific workarounds that weren't necessary on Chrome (it was mostly a webview use case so Safari and Chrome were the two we cared about at the time)

      Assumingly to me this was around the same time that Apple seemed to have DST problems more generally, such as their iOS alarm clock mishap https://www.theguardian.com/technology/blog/2010/nov/01/ipho...

    • JdeBP 2 days ago

      A quick test of Vivaldi with some of those shows it nowhere near as strict as your Firefox is. Amusingly

          new Date("2025-07-12 12:30:45 BST")
      
      is an invalid date, whereas all three of

          new Date("2025-07-12 12:30:45 GMT")
          new Date("2025-07-12 12:30:45 UTC")
          new Date("2025-07-12 12:30:45 Z")
      
      are valid but in British Summer Time.
    • samwho 2 days ago

      Yeah, as I understand it this isn’t backed by any spec. I decided to go with Node’s (v8’s) implementation for the quiz. Fun to see how much divergence there is!

saghm 2 days ago

At the beginning of the quiz, the author noted the exact time zone their laptop is in, have at least one of the questions I got wrong because I didn't take that into account. Totally valid though, and I honestly felt like I should have recognized that it would come into play given how I noticed how specific it was before starting

  • samwho a day ago

    It’s a mean thing for me to have done, and I did originally have an extra little disclaimer on the questions where it was relevant, but I removed it because it felt like the shock value was more funny.

    • saghm 12 hours ago

      I think it was more than fair! The point to me of the quiz is how unexpected the behavior is in all of these cases, and the behavior being time-zone dependent is certainly part of that