News for hackers. Stuff that matters.
Re:Time in Go by shellac on Thursday September 10, 2015 @08:40AM (#10197664)
> Go's "time" library is deceptively simple.

Has any language initially shipped with a non-broken date / time library? (See: SQL, java, python,...)

Clearly a very hard thing to get right, but post-JodaTime there a fewer excuses for APIs like:

> AddDate(y, m, d) to add a given number of years, months, days:

which pretty much defines 'deceptively simple'.

Re:Time in Go by steveklabnik on Thursday September 10, 2015 @12:06PM (#10198831)
With Rust, we pulled time out of the standard library before 1.0, specifically because we knew it wasn't up to the task. So if "no library" counts as a "non-broken" library...

We still don't have great libraries yet, but they're coming, slowly. Chrono is pretty good.

Re:Time in Go by kibwen on Thursday September 10, 2015 @12:37PM (#10199065)

  > Chrono is pretty good.
For purposes of comparison to other libraries, here's a link to Chrono's documentation: https://lifthrasiir.github.io/rust-chrono/chrono/
Re:Time in Go by shellac on Thursday September 10, 2015 @12:36PM (#10199049)
> With Rust, we pulled time out of the standard library before 1.0, specifically because we knew it wasn't up to the task.

This honestly strikes me a very good response. Saddling a still-growing community with sub-par core datatypes is worse than their absence.

> So if "no library" counts as a "non-broken" library...

Of course if I had phrased my question in terms of the 'first shipped date / time library' then Rust still has a chance to follow this illustrious trajectory for languages (i.e. really mess up). :-)

Re:Time in Go by buffoon on Thursday September 10, 2015 @08:56AM (#10197725)
.Net's is pretty good.

    var date = DateTime.UtcNow.AddDays(24).AddYears(-10);
In use:

   var billFor = 12; // months

   var firstDayOfMonth = DateTime.Today
       .AddDays(1 - DateTime.Today.Day);
    
   var billDates = Enumerable.Range(billFor)
       .Select(n => firstDayOfMonth.AddMonths(n));
Re:Time in Go by itsjustjoe on Friday September 18, 2015 @01:46PM (#10240777)
I'm going to have to disagree. DateTime is pretty limited, especially when it comes to timezones. I highly recommend NodaTime instead.
Re:Time in Go by mayoff on Thursday September 10, 2015 @01:17PM (#10199297)
Apple's date/time support (part of the Foundation framework in both iOS and Mac OS X) is fantastic. Better than anything else I've ever seen.