Created
May 31, 2011 12:32
-
-
Save iande/1000431 to your computer and use it in GitHub Desktop.
make_year
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def self.make_year(year, bias) | |
| # Check for year > 2 digits, etc | |
| # ... | |
| start_year = Chronic.time_class.now.year - bias | |
| century = (start_year / 100) * 100 | |
| full_year = century + year | |
| if full_year < start_year | |
| full_year + 100 | |
| else | |
| full_year | |
| end.to_s | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment