Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC][UN-13487] Fix diff in months #43

Merged
merged 5 commits into from
Jun 25, 2018
Merged

Conversation

asantos00
Copy link
Contributor

@asantos00 asantos00 commented Jun 20, 2018

Issue

https://uniplaces.atlassian.net/browse/UN-13487

What this does?

  • Fixes the bug where months where being counted twice, resulting into a month difference of 13 and when summed with years' difference would count a year twice
  • Adds all diffInMonths from php carbon` tests check here

@asantos00 asantos00 force-pushed the UN-13487/fix-diff-in-months branch from 88ae08c to dc615c0 Compare June 20, 2018 16:45
carbon.go Outdated
@@ -1187,7 +1187,7 @@ func (c *Carbon) DiffInMonths(carb *Carbon, abs bool) int64 {
if (diffHr - hrLastMonth) >= 0 {
var m int64
if c.Year() < carb.Year() {
m = (int64(monthsPerYear) - int64(c.In(time.UTC).Month())) + (int64(carb.In(time.UTC).Month()) - 1)
m = int64(monthsPerYear) - int64(c.In(time.UTC).Month()) + int64(carb.In(time.UTC).Month()) - 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go was giving a error reporting redundant parameters

@codecov-io
Copy link

codecov-io commented Jun 20, 2018

Codecov Report

Merging #43 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #43      +/-   ##
==========================================
- Coverage   91.49%   91.48%   -0.01%     
==========================================
  Files           3        3              
  Lines         858      857       -1     
==========================================
- Hits          785      784       -1     
  Misses         48       48              
  Partials       25       25
Impacted Files Coverage Δ
carbon.go 92.48% <100%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed4169d...f08f17d. Read the comment docs.

@asantos00 asantos00 force-pushed the UN-13487/fix-diff-in-months branch from 5fc365d to 7761d0b Compare June 22, 2018 14:27
@hfcorreia hfcorreia merged commit ac8e45a into master Jun 25, 2018
@hfcorreia hfcorreia deleted the UN-13487/fix-diff-in-months branch June 25, 2018 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants