From eabf187a7f2b67b88d7ef7e8ff2ee97654163e40 Mon Sep 17 00:00:00 2001 From: Marxsal Date: Sun, 7 Feb 2016 10:59:57 -0800 Subject: [PATCH] Update modified (updated) dates Without modified dates, new imports do not appear in recent file list. The equivalent of modified dates in ENEX is the 'updated' tag, with a date format similar to that of TW with the exception that the date format consists of a date stamp, a letter T, and a time stamp followed by Z for UTC presumably. There is no millisecond indicator. Not all ENEX notes have an update tag. The solution here is to apply creation date by default and then apply the update date if it is available. Dates are converted by stripping out Z and T and appending '000'. --- .../tiddlywiki/evernote/modules/enex-deserializer.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/tiddlywiki/evernote/modules/enex-deserializer.js b/plugins/tiddlywiki/evernote/modules/enex-deserializer.js index 3a4a2e96b..914b64a68 100644 --- a/plugins/tiddlywiki/evernote/modules/enex-deserializer.js +++ b/plugins/tiddlywiki/evernote/modules/enex-deserializer.js @@ -38,11 +38,19 @@ exports["application/enex+xml"] = function(text,fields) { title: getTextContent(noteNode,"title"), type: "text/html", tags: [], - text: getTextContent(noteNode,"content") + text: getTextContent(noteNode,"content"), + modified: getTextContent(noteNode,"created").replace("T","").replace("Z",""), + created: getTextContent(noteNode,"created").replace("T","").replace("Z","") + }; $tw.utils.each(noteNode.querySelectorAll("tag"),function(tagNode) { result.tags.push(tagNode.textContent); }); + // If there's an update date, set modifiy date accordingly + $tw.utils.each(noteNode.querySelectorAll("updated"),function(modifiedNode) { + result["modified"] = modifiedNode.textContent.replace("T","").replace("Z","") + "000" ; + }); + $tw.utils.each(noteNode.querySelectorAll("note-attributes"),function(attrNode) { result[attrNode.tagName] = attrNode.textContent; });