Skip to content

Commit

Permalink
Testing time in current timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
spcbfr committed Mar 26, 2024
1 parent cf7c792 commit e30b8fb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/pages/notes/index.astro
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
import { db, Note } from "astro:db";
const notes = await db.select().from(Note).orderBy(desc(Note.published));
import timezone from "dayjs/plugin/timezone";
import BaseLayout from "../../layouts/BaseLayout.astro";
import Link from "../../components/Link.astro";
import { desc } from "astro:db";
import dayjs from "dayjs";
dayjs.extend(timezone);
---

<BaseLayout title="notes!" description="Yusuf's note hub">
Expand All @@ -28,9 +30,15 @@ import dayjs from "dayjs";
>
<time
class="text-sm"
datetime={dayjs.unix(note.published).toISOString()}
datetime={dayjs
.unix(note.published)
.tz("Africa/Tunis")
.toISOString()}
>
{dayjs.unix(note.published).format("ddd, D MMM, YYYY, HH:mm")}
{dayjs
.unix(note.published)
.tz("Africa/Tunis")
.format("ddd, D MMM, YYYY, HH:mm")}
</time>
</a>
</div>
Expand Down

0 comments on commit e30b8fb

Please sign in to comment.