This commit is contained in:
frtk 2016-02-11 23:06:44 +01:00
parent 7032dadf8f
commit 4c20da7d65

View File

@ -1,58 +0,0 @@
/**
* @file server_utils.js
* @author frtk
*/
/**
* lib : DateLib
* purpose : date utils
*/
var datelib = {
//--- dateToString
dateToString: function(date) {
var self = this;
return '[' + self.addZero(date.getHours(), 'h') + ':'
+ self.addZero(date.getMinutes(), 'm') + ':'
+ self.addZero(date.getSeconds(), 's') + ':'
+ self.addZero(date.getMilliseconds(), 'ms') + ']';
},
//--- addZero
addZero: function(value, type) {
switch(type) {
case 'h':
case 'm':
case 's':
if (value < 10) value = '0' + value;
break;
case 'ms':
if (value < 10) value = '00' + value;
else if (value >= 10 && value < 100) value = '0' + value;
break;
default:
break;
};
return value;
},
//--- return new date string
newDateToString: function() {
var self = this;
return self.dateToString(new Date());
}
};
/**
*
* EXPORTS
*
*/
if (typeof exports !== "undefined") {
//--- Objects
exports.datelib = datelib;
}