Skip to content

Commit

Permalink
feat: format date
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Apr 9, 2023
1 parent 0e4b18c commit 14babf5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"@onekuma/reset": "^0.1.9",
"@unocss/reset": "^0.51.0",
"animegarden": "workspace:*",
"date-fns": "^2.29.3",
"date-fns-tz": "^2.0.0",
"unocss": "^0.51.0",
"vite-plugin-info": "^0.4.0"
}
Expand Down
6 changes: 5 additions & 1 deletion packages/app/src/components/ResourceTable.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
import type { Resource } from 'animegarden';
import { formatInTimeZone } from 'date-fns-tz';
export interface Props {
resources: Resource[];
}
Expand All @@ -20,7 +22,9 @@ const { resources } = Astro.props;
>{
resources.map((r) => (
<tr class="divide-x">
<td class="text-center">{new Date(r.createdAt).toLocaleString()}</td>
<td class="text-center">
{formatInTimeZone(new Date(r.createdAt), 'Asia/Shanghai', 'yyyy-MM-dd HH:mm')}
</td>
<td>
<a href={r.href} target="_blank" class="text-link">
{r.title}
Expand Down
19 changes: 19 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 14babf5

Please sign in to comment.