
module.exports.getPrettyDate = function(date) {
  var month = date.getMonth() + 1;
  var day = date.getDate();

  if (month < 10) {
    month = "0" + month;
  } 
  if (day < 10) {
    day = "0" + day;
  } 

  return month + "/" + day + "/" + date.getFullYear();
};   

module.exports.roundNumber = function (val) {
  return Math.round(val * 100000) / 100000;
};

module.exports.getDistanceFromLatLng = function(lat1, lng1, lat2, lng2) {
  var R = 6371;   // Radius of the earth in KM
  var dLat = deg2rad(lat2 - lat1);
  var dLng = deg2rad(lng2 - lng1);
  var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLng / 2) * Math.sin(dLng / 2);
  var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
  return  R * c;
};

var deg2rad = function (deg) { 
  return deg * (Math.PI / 180);
};

module.exports.isNumber = function(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
};
@@ -56,16 +56,31 @@
 month = 
+addLeadingZero(
 date.get
@@ -90,16 +90,17 @@
 th() + 1
+)
 ;%0A  var 
@@ -105,16 +105,31 @@
 r day = 
+addLeadingZero(
 date.get
@@ -138,70 +138,127 @@
 te()
+)
 ;%0A%0A  
-if (month %3C 10) %7B%0A    month = %220%22 + month;%0A  %7D 
+return month + %22/%22 + day + %22/%22 + date.getFullYear();%0A%7D;   %0A%0Avar addLeadingZero = function (number) %7B
 %0A  if (
-day
+number
  %3C 1
@@ -270,30 +270,32 @@
     
-day = %220%22 + day
+return '0' + number
 ;%0A  %7D
- %0A
 %0A  r
@@ -304,59 +304,18 @@
 urn 
-month + %22/%22 + day + %22/%22 + date.getFullYear()
+number
 ;%0A%7D;
-   
 %0A%0Amo

Update get pretty date in clienside