-
|
It makes the old function calls like AddDays or AddYearsNoOverflow work completely differently. In the past, you could call them and the durations would be applied and a new struct was returned, leaving the original untouched. Now calling them returns a struct but also mutates the underlying struct that we are acting on. This means updating to 2.6 is a MASSIVE undertaking if this package is used throughout a reasonably large codebase. This is a bit beyond a breaking change, this should be a v3, its completly changed the value and operation of the package as it is. Also this was not brought up as a breaking change. The questions are
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
This is a good question. Since c1 := carbon.Parse("2020-08-05 13:14:15")
c2 := c1.Copy().AddDays(2) |
Beta Was this translation helpful? Give feedback.
This is a good question. Since
v2.6, we have changed from avaluereceiver to apointerreceiver in order to improve performance and simplify the logic of customizing the time field output format whenMarshalJSONandUnmarshalJSON. This is a major breaking update that should theoretically be upgraded to thev3, but in golang,v3andv2are completely different packages and we do not want to distribute the package, so we upgraded tov2.6. It is recommended to upgrade tov2.6, which provides theCopymethod to avoid issues such as