refactor: improve type safety, Svelte 5 reactivity, and API resilience
This commit is contained in:
@@ -44,9 +44,11 @@ export const template_personal_log: ExportTemplate = {
|
||||
extension: 'md',
|
||||
formatter: (entries) => {
|
||||
// Sort entries by date ascending for a chronological log
|
||||
const sorted = [...entries].sort((a, b) =>
|
||||
(a.created_on || '').localeCompare(b.created_on || '')
|
||||
);
|
||||
const sorted = [...entries].sort((a, b) => {
|
||||
const dateA = a.created_on ? String(a.created_on) : '';
|
||||
const dateB = b.created_on ? String(b.created_on) : '';
|
||||
return dateA.localeCompare(dateB);
|
||||
});
|
||||
|
||||
return sorted.map(entry => {
|
||||
const dateStr = ae_util.iso_datetime_formatter(entry.created_on, 'date_iso');
|
||||
@@ -99,7 +101,7 @@ export const template_standard_html: ExportTemplate = {
|
||||
<article class="journal-entry" id="entry-${entry.journal_entry_id}">
|
||||
<header>
|
||||
<h1>${title}</h1>
|
||||
<time datetime="${entry.created_on}">${dateStr}</time>
|
||||
<time datetime="${String(entry.created_on)}">${dateStr}</time>
|
||||
</header>
|
||||
<div class="content">
|
||||
${entry.content_md_html || ''}
|
||||
|
||||
Reference in New Issue
Block a user