evernote导入丢失创建和更新时间 #75

https://github.com/leanote/desktop-app/issues/75
This commit is contained in:
life
2015-10-27 13:06:46 +08:00
parent 8296c01a02
commit fcecc47b65
3 changed files with 15 additions and 3 deletions

3
node_modules/common.js generated vendored
View File

@@ -48,6 +48,9 @@ var Common = {
return false;
},
isValidDate: function (d) {
return Object.prototype.toString.call(d) === "[object Date]" && !isNaN(d.getTime());
},
_uuid: 1,
uuid: function() {
this._uuid++;

8
node_modules/note.js generated vendored
View File

@@ -56,14 +56,18 @@ var Note = {
// console.log(noteOrContent);
var date = new Date();
noteOrContent.UpdatedTime = date;
if (!Common.isValidDate(noteOrContent.UpdatedTime)) {
noteOrContent.UpdatedTime = date;
}
noteOrContent['IsDirty'] = true; // 已修改
noteOrContent['LocalIsDelete'] = false;
// 新建笔记, IsNew还是保存着
if(noteOrContent.IsNew) {
noteOrContent.CreatedTime = date;
if (!Common.isValidDate(noteOrContent.CreatedTime)) {
noteOrContent.CreatedTime = date;
}
noteOrContent['IsTrash'] = false;
delete noteOrContent['IsNew'];
noteOrContent['LocalIsNew'] = true;