forked from
quillmatiq.com/augment
Fork of Chiri for Astro for my blog
1---
2import { themeConfig } from '@/config'
3import { formatDate } from '@/utils/date'
4import type { FormattedDateProps } from '@/types'
5
6const {
7 date,
8 format,
9 context = 'default'
10} = Astro.props as FormattedDateProps & { context?: 'list' | 'post' | 'default' }
11---
12
13<time
14 datetime={date.toISOString()}
15 class={!themeConfig.date.dateOnRight &&
16 (themeConfig.date.dateFormat === 'MONTH DAY YYYY' ||
17 themeConfig.date.dateFormat === 'DAY MONTH YYYY') &&
18 context === 'list'
19 ? 'date-left'
20 : ''}
21>
22 <Fragment set:html={formatDate(date, format)} />
23</time>
24
25<style>
26 .date-left {
27 display: inline-block;
28 min-width: 86px;
29 text-align: right;
30 }
31</style>