module.exports = (function(){
	return function unixToDate(unixTime) {
		console.log(unixTime)
		var date = new Date(Number(unixTime));
		var year = date.getFullYear();
		var month;
		var day;

		if (date.getMonth().toString().length === 1) {
			month = "0" + (date.getMonth() + 1).toString();
		} else {
			month = (date.getMonth() + 1).toString();
		}
		
		if (date.getDate().toString().length === 1) {
			day = "0" + date.getDay().toString();
		} else {
			day = date.getDate().toString();
		}

		return year + '-' + month + '-' + day;
	}
})();
module.exports = function(unixTime) {
	var date = new Date(Number(unixTime))
	var year = date.getFullYear()
	var month = constructMonth(date)
	var day = constructDay(date)

	return year + '-' + month + '-' + day
}

function constructMonth(date) {
	var month = (date.getMonth() + 1).toString()
	return padFormatting(month)
}

function constructDay(date) {
	var day = date.getDate().toString()
	return padFormatting(day)
}

function padFormatting(value) {
	return (value.length === 1) ? '0' + value : value
}

Refactor date conversion into smaller, more modular methods