r/javascript • • May 29 '13

Javascript Makes Me Cry: Turning a Date into a String

http://ralsina.com.ar/weblog/posts/javascript-makes-me-cry-turning-a-date-into-a-string.html
3 Upvotes

85 comments sorted by

View all comments

Show parent comments

-2

u/ralsina May 29 '13

Not yet.

0

u/[deleted] May 30 '13

[deleted]

0

u/ralsina May 30 '13

This thing has had all of 10 hours of development. Premature optimization is the root of all evil.

0

u/[deleted] May 30 '13

[deleted]

2

u/ralsina May 30 '13

Writing the solution: around 15 minutes. I could have used Moment.js it in that time, but actually learned it? All 64 screenfuls of docs? Nah. Would I have learned it exists and I would have been able to solve this problem? Sure. But then again, I do now know about it, and I do know how to solve this problem using it (and also some other 4 ways to do it), so nothing lost.

OTOH, I would have a solution, just like I do now, and a dependency to track, for something that it turns out I now know I don't even really need (again, because of a comment in this thread).

And I would not have learned a lot, which I did through the discussion here and in my blog.

OTOOH I have absolutely no idea what you mean by "not sensible for a language to try to manage them". Turning the JS Date objects into something like Moment's Moment objects is obviously doable, since Moment.js exists and it has exactly that.

As for writing the post, hey, I like doing that, or else I would not have a blog, you know.

1

u/actionscripted May 29 '13

Once you concat/minify/package, it's just one single request for all of your JS. I completely understand your point, that the native handling blows, but there are solutions that exist that you seem to be bent on not using just because they aren't core.

There is literally no downside, and I think you're getting down-voted because the solutions are there and you seem keen on refusing to implement them for reasons that aren't necessarily show-stopping.

1

u/ralsina May 29 '13

I already implemented a solution. Adding a 5KB library for literally no gain has no appeal, and I fail to see why that's seen as strange, myself.

Like I said in other responses, if I were doing several date manipulations? Sure, I would use it. To avoid one line I find distasteful, I'll pass.

I am very cautious about adding dependencies. At the very least, I would track new releases of those dependencies and upgrade them periodically, which means extra QA. That's an ongoing cost, which JS developers seem to willfully ignore.