You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							24 lines
						
					
					
						
							715 B
						
					
					
				
			
		
		
	
	
							24 lines
						
					
					
						
							715 B
						
					
					
				var addYears = require('../add_years/index.js') | 
						|
 | 
						|
/** | 
						|
 * @category Year Helpers | 
						|
 * @summary Subtract the specified number of years from the given date. | 
						|
 * | 
						|
 * @description | 
						|
 * Subtract the specified number of years from the given date. | 
						|
 * | 
						|
 * @param {Date|String|Number} date - the date to be changed | 
						|
 * @param {Number} amount - the amount of years to be subtracted | 
						|
 * @returns {Date} the new date with the years subtracted | 
						|
 * | 
						|
 * @example | 
						|
 * // Subtract 5 years from 1 September 2014: | 
						|
 * var result = subYears(new Date(2014, 8, 1), 5) | 
						|
 * //=> Tue Sep 01 2009 00:00:00 | 
						|
 */ | 
						|
function subYears (dirtyDate, dirtyAmount) { | 
						|
  var amount = Number(dirtyAmount) | 
						|
  return addYears(dirtyDate, -amount) | 
						|
} | 
						|
 | 
						|
module.exports = subYears
 | 
						|
 |