10

Fuck JS...

Can somebody explain me?

Comments
  • 2
    The extra space nulls out the time?
  • 1
    @asgs is that an actual question? If that's the case, I don't know.
  • 1
    @codepotato I don't know, either. See if you could read the spec (assuming this is covered) to know if there are any UBs
  • 3
  • 2
    @heyheni yeah but why does it fail? I wanna understand the error not just use something else. I wouldn't install a full library just to compare if a date is before/after another lol
  • 3
    @heyheni actually I would use date-fns if possible. Moment is pretty huge
  • 7
    @codepotato it's how the ISO standard is set up actually, so no blame on JS here. Sure JS lacks a lot of helper functions found in most other languages, but that example should work the same in all languages that follows ISO to the letter. ISO 8859 something I believe.

    Look up http://codingblocks.net podcast. Last two episodes deals with the ISO on dates in different languages. Sounds boring, but they make it interesting and fun.
  • 2
    @Hakash 👌a note on that in MDN docs

    https://developer.mozilla.org/en-US...
  • 0
    If I had to guess, the extra space makes the date parser think you're going to add in a time, but you don't. Do it just parses the date and fucks off, giving a blank time.

    I mean you acting as if programming ISN'T bitchy and specific about small things like this.
Add Comment