fix(blog::post::footer) remove update_date section if undefined

This commit is contained in:
lumither committed 2024-12-10 04:00:10 -08:00
1 parent 20c2964242
commit 19f84d2188
1 file changed
+11 -9
+11 -9
View File
@@ -17,7 +17,7 @@ const Footer = (props: Props) => {
const author = post['meta']['author'] ?? 'Tao'; const author = post['meta']['author'] ?? 'Tao';
const author_link = post['meta']['author_link'] ?? '/about'; const author_link = post['meta']['author_link'] ?? '/about';
const post_date = new Date(post['first_update']); const post_date = new Date(post['first_update']);
const update_date = new Date(post['last_update']); const update_date: Date | undefined = post['last_update'] ? new Date(post['last_update']) : undefined;
const cc = post['meta']['cc'] ?? 'by-nc-sa'; const cc = post['meta']['cc'] ?? 'by-nc-sa';
@@ -55,14 +55,16 @@ const Footer = (props: Props) => {
year: `numeric` year: `numeric`
}) }</p> }) }</p>
</div> </div>
<div> { update_date &&
<p className={ 'text-lg font-bold' }>Updated on</p> <div>
<p>{ update_date.toLocaleString('default', { <p className={ 'text-lg font-bold' }>Updated on</p>
month: `long`, <p>{ update_date.toLocaleString('default', {
day: `numeric`, month: `long`,
year: `numeric` day: `numeric`,
}) }</p> year: `numeric`
</div> }) }</p>
</div>
}
<div> <div>
<p className={ 'text-lg font-bold' }>Published under</p> <p className={ 'text-lg font-bold' }>Published under</p>
<Link href={ `https://creativecommons.org/licenses/${ cc }/4.0/` }> <Link href={ `https://creativecommons.org/licenses/${ cc }/4.0/` }>