From 745d2507874a63206f5878603945bada177795e0 Mon Sep 17 00:00:00 2001 From: Stefan du Fresne Date: Thu, 14 Dec 2017 13:16:37 +0000 Subject: [PATCH] Reorder Object.assign - Respects the dates that may be in input over default dates - Respects key and storage over what might be in input --- browser/main/lib/dataApi/createNote.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/browser/main/lib/dataApi/createNote.js b/browser/main/lib/dataApi/createNote.js index 1bb7f42a..4b667385 100644 --- a/browser/main/lib/dataApi/createNote.js +++ b/browser/main/lib/dataApi/createNote.js @@ -66,12 +66,16 @@ function createNote (storageKey, input) { } } } - const noteData = Object.assign({}, { - key, - createdAt: new Date(), - updatedAt: new Date(), - storage: storageKey - }, input) + const noteData = Object.assign({}, + { + createdAt: new Date(), + updatedAt: new Date() + }, + input, // input may contain more accurate dates + { + key, + storage: storageKey + }) CSON.writeFileSync(path.join(storage.path, 'notes', key + '.cson'), _.omit(noteData, ['key', 'storage']))