From e696f1ff1405aa5713b24d3364ac11ea84f78c66 Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Wed, 23 Nov 2022 21:46:57 +0100 Subject: [PATCH] :recycle: Allow date to be number (e.g., 2022) --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index 0d0f9f8..1d23d53 100644 --- a/src/index.ts +++ b/src/index.ts @@ -39,6 +39,8 @@ const parseNoteFile = async (dirName: string, year: string, file: string): Promi const date: Date = "date" in attributes && typeof attributes.date === "string" + ? new Date(attributes.date) + : "date" in attributes && typeof attributes.date === "number" ? new Date(attributes.date) : "date" in attributes && attributes.date instanceof Date ? attributes.date