Senior Software Engineer at Ravelin
-
Ravelin - @unravelin
- London
-
16:14
(UTC +01:00) - jamiewillis.io
Block or Report
Block or report jamster321
Report abuse
Contact GitHub support about this user’s behavior. Learn more about reporting abuse.
Report abusePinned
-
-
-
A function for adjusting dates by mo...
A function for adjusting dates by months in Go, while maintaining the day of the month where possible. If the target month does not have enough days the last day of the month is used. 1import "time"
23func AddMonths(d time.Time, months int) time.Time {
4targetMonth := d.AddDate(0, months, 1-d.Day())
5daysInTargetMonth := targetMonth.AddDate(0, 1, -1).Day()
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.