mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-16 16:04:56 +00:00
evernote导入丢失创建和更新时间 #75
https://github.com/leanote/desktop-app/issues/75
This commit is contained in:
3
node_modules/common.js
generated
vendored
3
node_modules/common.js
generated
vendored
@@ -48,6 +48,9 @@ var Common = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
isValidDate: function (d) {
|
||||||
|
return Object.prototype.toString.call(d) === "[object Date]" && !isNaN(d.getTime());
|
||||||
|
},
|
||||||
_uuid: 1,
|
_uuid: 1,
|
||||||
uuid: function() {
|
uuid: function() {
|
||||||
this._uuid++;
|
this._uuid++;
|
||||||
|
8
node_modules/note.js
generated
vendored
8
node_modules/note.js
generated
vendored
@@ -56,14 +56,18 @@ var Note = {
|
|||||||
// console.log(noteOrContent);
|
// console.log(noteOrContent);
|
||||||
|
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
noteOrContent.UpdatedTime = date;
|
if (!Common.isValidDate(noteOrContent.UpdatedTime)) {
|
||||||
|
noteOrContent.UpdatedTime = date;
|
||||||
|
}
|
||||||
|
|
||||||
noteOrContent['IsDirty'] = true; // 已修改
|
noteOrContent['IsDirty'] = true; // 已修改
|
||||||
noteOrContent['LocalIsDelete'] = false;
|
noteOrContent['LocalIsDelete'] = false;
|
||||||
|
|
||||||
// 新建笔记, IsNew还是保存着
|
// 新建笔记, IsNew还是保存着
|
||||||
if(noteOrContent.IsNew) {
|
if(noteOrContent.IsNew) {
|
||||||
noteOrContent.CreatedTime = date;
|
if (!Common.isValidDate(noteOrContent.CreatedTime)) {
|
||||||
|
noteOrContent.CreatedTime = date;
|
||||||
|
}
|
||||||
noteOrContent['IsTrash'] = false;
|
noteOrContent['IsTrash'] = false;
|
||||||
delete noteOrContent['IsNew'];
|
delete noteOrContent['IsNew'];
|
||||||
noteOrContent['LocalIsNew'] = true;
|
noteOrContent['LocalIsNew'] = true;
|
||||||
|
@@ -87,6 +87,8 @@ var Import = {
|
|||||||
|
|
||||||
// 20150206T031506Z
|
// 20150206T031506Z
|
||||||
parseEvernoteTime: function (str) {
|
parseEvernoteTime: function (str) {
|
||||||
|
// console.log('parseEvernoteTime');
|
||||||
|
// console.log(str);
|
||||||
if (!str || typeof str != 'string' || str.length != '20150206T031506Z'.length) {
|
if (!str || typeof str != 'string' || str.length != '20150206T031506Z'.length) {
|
||||||
return new Date();
|
return new Date();
|
||||||
}
|
}
|
||||||
@@ -100,7 +102,7 @@ var Import = {
|
|||||||
|
|
||||||
var d = new Date(year + '-' + month + '-' + day + ' ' + h + ':' + m + ':' + s);
|
var d = new Date(year + '-' + month + '-' + day + ' ' + h + ':' + m + ':' + s);
|
||||||
// invalid
|
// invalid
|
||||||
if (!isNaN(d.getTime())) {
|
if (isNaN(d.getTime())) {
|
||||||
return new Date();
|
return new Date();
|
||||||
}
|
}
|
||||||
return d;
|
return d;
|
||||||
@@ -247,6 +249,9 @@ var Import = {
|
|||||||
jsonNote.Desc = '';
|
jsonNote.Desc = '';
|
||||||
jsonNote.IsMarkdown = false;
|
jsonNote.IsMarkdown = false;
|
||||||
|
|
||||||
|
// console.log('----------');
|
||||||
|
// console.log(jsonNote);
|
||||||
|
|
||||||
// 添加tags
|
// 添加tags
|
||||||
if(jsonNote.Tags && jsonNote.Tags.length > 0) {
|
if(jsonNote.Tags && jsonNote.Tags.length > 0) {
|
||||||
for(var h = 0; h < jsonNote.Tags.length; ++h) {
|
for(var h = 0; h < jsonNote.Tags.length; ++h) {
|
||||||
|
Reference in New Issue
Block a user