Skip to content

Commit

Permalink
revert timestamp conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuanqi committed Aug 20, 2023
1 parent 4bb928f commit 837095d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
9 changes: 0 additions & 9 deletions packages/tools/markdown-converter/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(",")
Expand Down
6 changes: 3 additions & 3 deletions packages/tools/markdown-converter/lib.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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---`
);
});

Expand Down

0 comments on commit 837095d

Please sign in to comment.