Skip to content

Commit d7b1082

Browse files
Add defensive handling for timestamp display in browser demos
Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent c14e44a commit d7b1082

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

examples/browser-demo/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,11 @@ <h2>🖥️ Console Output</h2>
475475
${task.title}
476476
</div>
477477
<div class="task-meta">
478-
ID: ${task.id} | Created: ${new Date(task.created_at).toLocaleString()}
478+
ID: ${task.id} | Created: ${
479+
task.created_at && !isNaN(new Date(task.created_at).getTime())
480+
? new Date(task.created_at).toLocaleString()
481+
: 'Unknown'
482+
}
479483
</div>
480484
</div>
481485
<div class="task-actions">

examples/browser-localstorage-demo/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,11 @@ <h2>🖥️ Console Output</h2>
314314
<div>
315315
<strong>${note.content}</strong>
316316
<div style="font-size: 0.85em; color: #666; margin-top: 5px;">
317-
Created: ${new Date(note.created_at).toLocaleString()}
317+
Created: ${
318+
note.created_at && !isNaN(new Date(note.created_at).getTime())
319+
? new Date(note.created_at).toLocaleString()
320+
: 'Unknown'
321+
}
318322
</div>
319323
</div>
320324
<button class="danger" onclick="deleteNote('${note.id}')">🗑</button>

0 commit comments

Comments
 (0)