5

Javascript is actually a weird language which I dunno why I like a lot.
new Date() in NodeJS gives a different value, while new Date() in the browser console(so react js and normal js) gives a different value.
I dunno if my online searching skills are bad but I didn't find anyone addressing this online. Lol I had to create a manual work around for it then.

Comments
  • 1
    That is because what you see on logging a Date object is "prettified" by the console. Because it makes sense there.

    To actually work with it use getDay and shit like that on it instead of parsing it.^^
  • 1
    From the Date.parse() article on MDN: "There are still many differences in how different hosts parse date strings." In the Date MDN article: "Parsing of strings with Date.parse is strongly discouraged due to browser differences and inconsistencies." Date.parse() implicitly calls new Date(), they are equivalent. Also, ReactJS is built on vanilla JS, not sure why you make that distinction in your rant.
  • 1
    @nitwhiz ya that's how I worked with it in the end.
  • 0
    @52cal ohh yes I forgot that react runs vanilla js, and don't you think it is something quite significant to be made uniform across different browser engines
  • 2
    They give different values because some time passed between you using them. 😈
  • 1
    Cuz JS sucks.
  • 0
    @Quirinus lmfao that's not what I meant
Add Comment