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
						
					
					
						
							652 B
						
					
					
				
			
		
		
	
	
							24 lines
						
					
					
						
							652 B
						
					
					
				var startOfDay = require('../start_of_day/index.js') | 
						|
 | 
						|
/** | 
						|
 * @category Day Helpers | 
						|
 * @summary Is the given date yesterday? | 
						|
 * | 
						|
 * @description | 
						|
 * Is the given date yesterday? | 
						|
 * | 
						|
 * @param {Date|String|Number} date - the date to check | 
						|
 * @returns {Boolean} the date is yesterday | 
						|
 * | 
						|
 * @example | 
						|
 * // If today is 6 October 2014, is 5 October 14:00:00 yesterday? | 
						|
 * var result = isYesterday(new Date(2014, 9, 5, 14, 0)) | 
						|
 * //=> true | 
						|
 */ | 
						|
function isYesterday (dirtyDate) { | 
						|
  var yesterday = new Date() | 
						|
  yesterday.setDate(yesterday.getDate() - 1) | 
						|
  return startOfDay(dirtyDate).getTime() === startOfDay(yesterday).getTime() | 
						|
} | 
						|
 | 
						|
module.exports = isYesterday
 | 
						|
 |