@@ -53,16 +53,29 @@ fetch(`./posts/entries/${slug}.md`)
5353 bodyDiv . innerHTML = html ;
5454 content . appendChild ( bodyDiv ) ;
5555
56+ let rawDate = meta . date ? new Date ( meta . date ) : null ;
57+
58+ let dateDisplay ;
59+ if ( rawDate instanceof Date && ! isNaN ( rawDate ) ) {
60+ const Y = rawDate . getFullYear ( ) ;
61+ const M = String ( rawDate . getMonth ( ) + 1 ) . padStart ( 2 , "0" ) ;
62+ const D = String ( rawDate . getDate ( ) ) . padStart ( 2 , "0" ) ;
63+ dateDisplay = `${ Y } -${ M } -${ D } ` ;
64+ } else {
65+ dateDisplay = "In a fragment of time" ;
66+ }
67+
5668 const footerDiv = document . createElement ( "div" ) ;
57- footerDiv . id = "post-meta" ;
58- footerDiv . className = "post-location" ;
59- const author = meta . author || "Anonymous" ;
60- const date = meta . date || "In a fragment of time" ;
61- footerDiv . textContent = `${ author } , ${ date } ${ meta . location ? ' in ' + meta . location : " Somewhere on Earth" } ` ;
69+ footerDiv . id = "post-meta" ;
70+ footerDiv . className = "post-location" ;
6271 footerDiv . style . textAlign = "right" ;
72+ const author = meta . author || "Anonymous" ;
73+ const locationPart = meta . location
74+ ? ` in ${ meta . location } `
75+ : " Somewhere on Earth" ;
76+ footerDiv . textContent = `${ author } , ${ dateDisplay } ${ locationPart } ` ;
6377 content . appendChild ( footerDiv ) ;
6478
65-
6679 // If MathJax is present, render any math
6780 if ( window . MathJax ) {
6881 window . MathJax . typesetPromise ?. ( [ content ] ) ;
0 commit comments