From 837095d0a88ca1028e3293f19fba655a193c25bc Mon Sep 17 00:00:00 2001 From: Chuanqi Date: Sat, 19 Aug 2023 19:12:09 -0700 Subject: [PATCH] revert timestamp conversion --- packages/tools/markdown-converter/lib.js | 9 --------- packages/tools/markdown-converter/lib.test.js | 6 +++--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/tools/markdown-converter/lib.js b/packages/tools/markdown-converter/lib.js index 0a36347..efdf175 100644 --- a/packages/tools/markdown-converter/lib.js +++ b/packages/tools/markdown-converter/lib.js @@ -38,15 +38,6 @@ export function handleHeaderLines(haikuFile, headerLines) { value = `"${value}"`; } - if (key === "created") { - const date = new Date(value); - const shortLocalDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, "0")}-${date - .getDate() - .toString() - .padStart(2, "0")}`; - return `${key}: ${shortLocalDate}`; - } - if (key === "tags") { const tags = value .split(",") diff --git a/packages/tools/markdown-converter/lib.test.js b/packages/tools/markdown-converter/lib.test.js index e443e30..59a094c 100644 --- a/packages/tools/markdown-converter/lib.test.js +++ b/packages/tools/markdown-converter/lib.test.js @@ -40,11 +40,11 @@ describe("header", () => { it("coverts date", () => { assert.strictEqual( handleHeaderLines("", fileToLines(`#+title: hello\n#+created: 2023-08-19T23:59:59-07:00`).headerLines), - `---\ntitle: hello\ncreated: 2023-08-19\n---` + `---\ntitle: hello\ncreated: 2023-08-19T23:59:59-07:00\n---` ); assert.strictEqual( - handleHeaderLines("", fileToLines(`#+title: hello\n#+created: 2023-08-19T00:00:01-07:00`).headerLines), - `---\ntitle: hello\ncreated: 2023-08-19\n---` + handleHeaderLines("", fileToLines(`#+title: hello\n#+created: 2023-08-19T00:00:01+07:00`).headerLines), + `---\ntitle: hello\ncreated: 2023-08-19T00:00:01+07:00\n---` ); });