Created
          March 24, 2011 19:01 
        
      - 
      
 - 
        
Save lucastex/885631 to your computer and use it in GitHub Desktop.  
    Somando dias na data
  
        
  
    
      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
    
  
  
    
  | Integer.metaClass.propertyMissing = { name -> | |
| if (name == "day" || name == "days") { | |
| return delegate | |
| } else if (name == "month" || name == "months") { | |
| return delegate * 30 | |
| } else if (name == "year" || name == "years") { | |
| return delegate * 30 * 12 | |
| } else { | |
| throw new MissingPropertyException(delegate) | |
| } | |
| } | |
| println new Date() | |
| println new Date() + 1.day | |
| println new Date() + 10.days | |
| println new Date() + 1.month | |
| println new Date() + 10.months | |
| println new Date() + 1.year | |
| println new Date() + 10.years | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment