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

Depreciation fix #27

Merged
merged 2 commits into from Nov 18, 2013
Merged

Depreciation fix #27

merged 2 commits into from Nov 18, 2013

Conversation

uberbrady
Copy link
Collaborator

Depreciation now does math based on Year and month - completely ignoring day.

It figures out the number of year-mo's since year 0 - the math looking like this:

year*12 + (month-1)

The month-1 thing is to make months be zero-based instead of one-based (January is 0, December is 11).

Formatting dates into that format and then subtracting gives you a 'rounded month difference' - e.g. February 1 minus january 31 is one month. February 28 minus february 1 is zero months.

I also put some error checking in around zero-length depreciation (causes a division-by-zero error otherwise), as well as non-existent deprecations themselves.

Fixes #1

snipe added a commit that referenced this pull request Nov 18, 2013
@snipe snipe merged commit 4da2bcc into develop Nov 18, 2013
@uberbrady uberbrady deleted the depreciation_fix branch November 18, 2013 04:34
@kwinters1 kwinters1 mentioned this pull request Apr 16, 2015
@ghost ghost mentioned this pull request May 20, 2015
This was referenced Jun 9, 2015
This was referenced Jun 12, 2015
@NicksMacLife NicksMacLife mentioned this pull request Aug 15, 2015
@patgmac patgmac mentioned this pull request Oct 19, 2015
@cookierun22 cookierun22 mentioned this pull request Jan 28, 2023
2 tasks
@Bjufen Bjufen mentioned this pull request Feb 9, 2023
2 tasks
This was referenced Aug 22, 2023
@jayavman jayavman mentioned this pull request Sep 2, 2023
2 tasks
@manhvt20 manhvt20 mentioned this pull request Mar 18, 2024
2 tasks
@uglycrab uglycrab mentioned this pull request Mar 27, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants