Check out this list, some incredibly perfect things for the most special and perfect language there is, love that it powers practically the world: wtfjs
Check out this list, some incredibly perfect things for the most special and perfect language there is, love that it powers practically the world: wtfjs
Okay that was great. Thanks, I feel like I learned something that I will immediately forget and has no practical use, because when would I want to rely on any of that functionality.
Okay that was great.
Thanks, I feel like I learned something that I will immediately forget and has no practical use, because when would I want to rely on any of that functionality.
I work with this language every single day, and new Date(“maybe 1”) evaluating to 11pm on 30 April 2001 may be one of the most upsetting pieces of news that I’ve ever been delivered. I’ll be...
I work with this language every single day, and new Date(“maybe 1”) evaluating to 11pm on 30 April 2001 may be one of the most upsetting pieces of news that I’ve ever been delivered. I’ll be putting in my notice at work this morning.
This is very common in JavaScript. Almost no browser APIs throw errors, instead we get undefined, NaN, and Invalid Date. I think that the underlying principle is that JavaScript was first designed...
This is very common in JavaScript. Almost no browser APIs throw errors, instead we get undefined, NaN, and Invalid Date. I think that the underlying principle is that JavaScript was first designed to allow some minimal amount of scripting on top of the DOM, and it's "better" for website viewers if the date widget shows up but reads "Invalid Date", then if all of the website's interactivity breaks because of a Date math error.
For all of the non-JS devs in here completely baffled by how monstrously bad the JavaScript Date interface is... We know haha. TC39 has been working on a new set of APIs for time in JavaScript for...
For all of the non-JS devs in here completely baffled by how monstrously bad the JavaScript Date interface is... We know haha. TC39 has been working on a new set of APIs for time in JavaScript for ten years. It's rolling out across the ecosystem now, actually. It launched in Firefox last year, in Chrome last month, and is being worked on actively in Safari. Last month's Chrome launch means that it will likely be available soon in Node.js as well. Deno actually unflagged it two years ago. Seems like Bun is lagging behind a bit but I imagine that they'll race to catch up once Node.js releases it.
Anyway, all that to say, there are a lot of really smart and passionate folks that are trying very hard to make JavaScript better, and Temporal is going to end up being one of the better date and time interfaces across programming languages. And it should start being more broadly available by the end of this year, which is huge!
The JS Date object is so awful that no sane developer uses it beyond the most trivial use cases. Most of us use wrapper libraries, like Moment.js or date-fns.
The JS Date object is so awful that no sane developer uses it beyond the most trivial use cases. Most of us use wrapper libraries, like Moment.js or date-fns.
I got 11 right somehow despite being very rusty in JavaScript. Nice way to highlight how convoluted the date system is. I was starting to fear it would manually count all months after the start...
I got 11 right somehow despite being very rusty in JavaScript. Nice way to highlight how convoluted the date system is.
I was starting to fear it would manually count all months after the start date one by one... And that may actually be more logical than how it actually works.
This only reminds me why I refuse to code in JavaScript when I can avoid it. So much web design can happen without that sloppy language. I'll write in something else and let it cross-compile into...
This only reminds me why I refuse to code in JavaScript when I can avoid it. So much web design can happen without that sloppy language. I'll write in something else and let it cross-compile into JS for me, thanks.
I've learned quite a few languages over the years and JavaScript is by far the most frustrating work of coding I've ever had the displeasure to work with. I actively avoid it whenever possible...
I've learned quite a few languages over the years and JavaScript is by far the most frustrating work of coding I've ever had the displeasure to work with. I actively avoid it whenever possible because it's just so nonsensical.
What’s worse to me is that Microsoft TypeScript purports to fix all the issues that JavaScript has, but it just introduces its own issues. Every time I end up looking at TypeScript code, it’s rife...
What’s worse to me is that Microsoft TypeScript purports to fix all the issues that JavaScript has, but it just introduces its own issues. Every time I end up looking at TypeScript code, it’s rife with the “any” variable type. Sure, let’s fix all the problems that JavaScript has, but leave a back door to use them just in case. It’s meant to be used judiciously by an experienced programmer, but that’s never stopped a novice from banging on, in my experience. At least this was true the last time I looked at it, but I haven’t bothered to investigate TS in some years.
Even in non-transpired languages, you’re allowed to cast things to the most generic base type and essentially opt out of the type system. Even in C, that’s what void pointers are for. It’s not...
Even in non-transpired languages, you’re allowed to cast things to the most generic base type and essentially opt out of the type system. Even in C, that’s what void pointers are for.
perfectly sane language for perfectly sane people
Similarly:
Check out this list, some incredibly perfect things for the most special and perfect language there is, love that it powers practically the world: wtfjs
Okay that was great.
Thanks, I feel like I learned something that I will immediately forget and has no practical use, because when would I want to rely on any of that functionality.
I work with this language every single day, and
new Date(“maybe 1”)evaluating to 11pm on 30 April 2001 may be one of the most upsetting pieces of news that I’ve ever been delivered. I’ll be putting in my notice at work this morning.It's annoying that is not even consistent, on Firefox returns "Invalid Date"
I’m going to cry.
Separately, am I being silly here in not understanding why Invalid Date date objects even exist? Why not just throw an error?
This is very common in JavaScript. Almost no browser APIs throw errors, instead we get
undefined,NaN, andInvalid Date. I think that the underlying principle is that JavaScript was first designed to allow some minimal amount of scripting on top of the DOM, and it's "better" for website viewers if the date widget shows up but reads "Invalid Date", then if all of the website's interactivity breaks because of a Date math error.So, how would you define the end of your notice period using the Date class? c:
Obligatory link (one of my favorite ever lightning talks): https://www.destroyallsoftware.com/talks/wat
Got like 8 wrong in a row and rage quit. I actually like js but man it has to be one of the oddest non-esoteric languages in existence.
For all of the non-JS devs in here completely baffled by how monstrously bad the JavaScript Date interface is... We know haha. TC39 has been working on a new set of APIs for time in JavaScript for ten years. It's rolling out across the ecosystem now, actually. It launched in Firefox last year, in Chrome last month, and is being worked on actively in Safari. Last month's Chrome launch means that it will likely be available soon in Node.js as well. Deno actually unflagged it two years ago. Seems like Bun is lagging behind a bit but I imagine that they'll race to catch up once Node.js releases it.
Anyway, all that to say, there are a lot of really smart and passionate folks that are trying very hard to make JavaScript better, and Temporal is going to end up being one of the better date and time interfaces across programming languages. And it should start being more broadly available by the end of this year, which is huge!
Managed to get 13 right without knowing JS, but this is truly insane. What even are these type coercions. Truly glad to not be a webdev lol.
The JS Date object is so awful that no sane developer uses it beyond the most trivial use cases. Most of us use wrapper libraries, like Moment.js or date-fns.
I got 11 right somehow despite being very rusty in JavaScript. Nice way to highlight how convoluted the date system is.
I was starting to fear it would manually count all months after the start date one by one... And that may actually be more logical than how it actually works.
This only reminds me why I refuse to code in JavaScript when I can avoid it. So much web design can happen without that sloppy language. I'll write in something else and let it cross-compile into JS for me, thanks.
I've learned quite a few languages over the years and JavaScript is by far the most frustrating work of coding I've ever had the displeasure to work with. I actively avoid it whenever possible because it's just so nonsensical.
What’s worse to me is that Microsoft TypeScript purports to fix all the issues that JavaScript has, but it just introduces its own issues. Every time I end up looking at TypeScript code, it’s rife with the “any” variable type. Sure, let’s fix all the problems that JavaScript has, but leave a back door to use them just in case. It’s meant to be used judiciously by an experienced programmer, but that’s never stopped a novice from banging on, in my experience. At least this was true the last time I looked at it, but I haven’t bothered to investigate TS in some years.
Even in non-transpired languages, you’re allowed to cast things to the most generic base type and essentially opt out of the type system. Even in C, that’s what void pointers are for.
It’s not really an option not to have.
Even Rust has
unsafein some core libraries!