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;
	}
})();
@@ -10,17 +10,16 @@
 ports = 
-(
 function
@@ -23,76 +23,20 @@
 ion(
-)%7B%0A%09return function unixToDate(unixTime) %7B%0A%09%09console.log(unixTime)%0A%09
+unixTime) %7B%0A
 %09var
@@ -69,19 +69,17 @@
 ixTime))
-;%0A%09
+%0A
 %09var yea
@@ -100,19 +100,17 @@
 llYear()
-;%0A%09
+%0A
 %09var mon
@@ -115,136 +115,142 @@
 onth
-;%0A%09%09var day;%0A%0A%09%09if (date.getMonth().toString().length === 1) %7B%0A%09%09%09
+ = constructMonth(date)%0A%09var day = constructDay(date)%0A%0A%09return year + '-' + 
 month 
-= %220%22
++ '-'
  + 
-(
 da
-te.getMonth() + 1).toString();%0A%09%09%7D else %7B%0A%09%09%09
+y%0A%7D%0A%0Afunction constructMonth(date) %7B%0A%09var 
 mont
@@ -289,79 +289,81 @@
 ng()
-;
 %0A%09
-%09%7D%0A%09%09%0A%09%09if (date.getDate().toString().length === 1
+return padFormatting(month)%0A%7D%0A%0Afunction constructDay(date
 ) %7B%0A%09
-%09%09
+var 
 day =
- %220%22 +
  dat
@@ -369,17 +369,18 @@
 te.getDa
-y
+te
 ().toStr
@@ -388,71 +388,79 @@
 ng()
-;
 %0A%09
-%09%7D else %7B%0A%09%09%09day = date.getDate().toString();%0A%09%09%7D%0A%0A%09
+return padFormatting(day)%0A%7D%0A%0Afunction padFormatting(value) %7B%0A
 %09return 
 year
@@ -459,44 +459,49 @@
 urn 
-year + '-' + month + '-
+(value.length === 1) ? '0
 ' + 
-day;%0A%09%7D%0A%7D)();
+value : value%0A%7D%0A

Refactor date conversion into smaller, more modular methods