Given a time object, t := time.Now()
, is there a way I could get a timestamp for the first and last days of that year?
I could do something like d := t.YearDay()
to get the number of days through the year, and then t.AddDate(0, 0, -d)
to get the start of the year, and t.AddDate(0, 0, 365-d)
to get the end of the year, but that seems to brittle as it doesn't deal with leap years etc.