by chimeracoder · 12y ago · 0 comments
I have gotten incredibly spoiled in this regard, and it's incredibly painful now to deal with time in Python or (even worse) Javascript[0].
This isn't even getting at the synchronization/timing features, which Go provides amazing support for as well.
[0] My jaw hit the floor when I saw how difficult it is to get the name of a month from a Date object in Javascript: https://stackoverflow.com/questions/1643320/get-month-name-f...
I suggest looking into Arrow:
My experience is that Arrow fixes date/time handling for Python the same way Requests fixes HTTP handling.
I find the information at http://golang.org/pkg/time/#pkg-constants very explanatory.
What do you think is unclear about the documentation?
new Date("10/11/2014").toLocaleString("en-us", { month: "long" });It's especially ridiculous in Javascript because the internal functions make use of it (try calling (new Date()).toString()), but they don't give direct access to it.
A well-designed stdlib should handle all of these basic things without requiring the programmer to do any extra work. It's especially important when talking about time, because there are so many wacky edge cases that no programmer is ever going to be able to predict all of them if they have to roll it themselves.