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;
|
||||
},
|
||||
isValidDate: function (d) {
|
||||
return Object.prototype.toString.call(d) === "[object Date]" && !isNaN(d.getTime());
|
||||
},
|
||||
_uuid: 1,
|
||||
uuid: function() {
|
||||
this._uuid++;
|
||||
|
4
node_modules/note.js
generated
vendored
4
node_modules/note.js
generated
vendored
@@ -56,14 +56,18 @@ var Note = {
|
||||
// console.log(noteOrContent);
|
||||
|
||||
var date = new Date();
|
||||
if (!Common.isValidDate(noteOrContent.UpdatedTime)) {
|
||||
noteOrContent.UpdatedTime = date;
|
||||
}
|
||||
|
||||
noteOrContent['IsDirty'] = true; // 已修改
|
||||
noteOrContent['LocalIsDelete'] = false;
|
||||
|
||||
// 新建笔记, IsNew还是保存着
|
||||
if(noteOrContent.IsNew) {
|
||||
if (!Common.isValidDate(noteOrContent.CreatedTime)) {
|
||||
noteOrContent.CreatedTime = date;
|
||||
}
|
||||
noteOrContent['IsTrash'] = false;
|
||||
delete noteOrContent['IsNew'];
|
||||
noteOrContent['LocalIsNew'] = true;
|
||||
|
@@ -87,6 +87,8 @@ var Import = {
|
||||
|
||||
// 20150206T031506Z
|
||||
parseEvernoteTime: function (str) {
|
||||
// console.log('parseEvernoteTime');
|
||||
// console.log(str);
|
||||
if (!str || typeof str != 'string' || str.length != '20150206T031506Z'.length) {
|
||||
return new Date();
|
||||
}
|
||||
@@ -100,7 +102,7 @@ var Import = {
|
||||
|
||||
var d = new Date(year + '-' + month + '-' + day + ' ' + h + ':' + m + ':' + s);
|
||||
// invalid
|
||||
if (!isNaN(d.getTime())) {
|
||||
if (isNaN(d.getTime())) {
|
||||
return new Date();
|
||||
}
|
||||
return d;
|
||||
@@ -247,6 +249,9 @@ var Import = {
|
||||
jsonNote.Desc = '';
|
||||
jsonNote.IsMarkdown = false;
|
||||
|
||||
// console.log('----------');
|
||||
// console.log(jsonNote);
|
||||
|
||||
// 添加tags
|
||||
if(jsonNote.Tags && jsonNote.Tags.length > 0) {
|
||||
for(var h = 0; h < jsonNote.Tags.length; ++h) {
|
||||
|
Reference in New Issue
Block a user