diff --git a/_components/Feedback.tsx b/_components/Feedback.tsx index 5798bca32..b1914f48c 100644 --- a/_components/Feedback.tsx +++ b/_components/Feedback.tsx @@ -3,6 +3,25 @@ export default function Feedback({ file }: { file: string | undefined }) { return <></>; } else { const githubPath = "https://github.com/denoland/docs/edit/main" + file; + + let modifiedDate = null; + try { + const dateString = new TextDecoder().decode( + (new Deno.Command("git", { + args: [ + "log", + "-1", + "--pretty=%cI", + "./" + file, + ], + })).outputSync().stdout, + ); + + modifiedDate = new Date(dateString); + } catch (e) { + console.log(e); + } + return ( <section id="feedback-section" @@ -138,6 +157,20 @@ export default function Feedback({ file }: { file: string | undefined }) { </button> </div> </div> + {modifiedDate && + ( + <div class="mt-4"> + This page was last modified on{" "} + <time datetime={modifiedDate.toString()}> + {modifiedDate.toLocaleString("en", { + year: "numeric", + month: "short", + day: "numeric", + })} + </time>. + </div> + )} + <a rel="" class="mt-4 !underline underline-offset-2 text-xs block"