添加/修改笔记同步传updatedTime, createdTime

This commit is contained in:
life
2015-11-01 11:05:48 +08:00
parent 580220eee4
commit 377af3e26c
2 changed files with 33 additions and 3 deletions

28
node_modules/common.js generated vendored
View File

@@ -21,6 +21,23 @@ process.on('uncaughtException', function (err) {
*/
function log(o) {console.log(o)}
Date.prototype.format = function(fmt) { //author: meizz
var o = {
"M+" : this.getMonth()+1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth()+3)/3), //季度
"S" : this.getMilliseconds() //毫秒
};
if(/(y+)/.test(fmt))
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
for(var k in o)
if(new RegExp("("+ k +")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
return fmt;
}
// log("<>>>>>>>>>>>>>>>>>>>>");
var Common = {
objectId: function() {
@@ -187,6 +204,17 @@ var Common = {
}
},
formatDatetime: function (t) {
if (!t) {
t = new Date();
}
try {
return t.format("yyyy-MM-dd hh:mm:ss");
} catch(e) {
return '';
}
},
// 获取文件的json数据
getFileJson: function(filepath) {
var me = this;