Scratch space for learning atproto app development

Smarter timestamps

Changed files
+6 -1
src
pages
+6 -1
src/pages/home.ts
···
import { html } from '../view'
import { shell } from './shell'
const STATUS_OPTIONS = [
'๐Ÿ‘',
'๐Ÿ‘Ž',
···
</div>
${statuses.map((status, i) => {
const handle = didHandleMap[status.authorDid] || status.authorDid
return html`
<div class=${i === 0 ? 'status-line no-line' : 'status-line'}>
<div>
···
</div>
<div class="desc">
<a class="author" href=${toBskyLink(handle)}>@${handle}</a>
-
is feeling ${status.status} on ${ts(status)}
</div>
</div>
`
···
import { html } from '../view'
import { shell } from './shell'
+
const TODAY = new Date().toDateString()
+
const STATUS_OPTIONS = [
'๐Ÿ‘',
'๐Ÿ‘Ž',
···
</div>
${statuses.map((status, i) => {
const handle = didHandleMap[status.authorDid] || status.authorDid
+
const date = ts(status)
return html`
<div class=${i === 0 ? 'status-line no-line' : 'status-line'}>
<div>
···
</div>
<div class="desc">
<a class="author" href=${toBskyLink(handle)}>@${handle}</a>
+
${date === TODAY
+
? `is feeling ${status.status} today`
+
: `was feeling ${status.status} on ${date}`}
</div>
</div>
`