Skip to content

Commit

Permalink
feat(bookmarks): consider America/Sao_Paulo tz
Browse files Browse the repository at this point in the history
  • Loading branch information
noghartt committed Nov 1, 2024
1 parent c29583c commit 04850cc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pages/bookmarks/index.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import dayjs from 'dayjs';
import dayjsTimezone from 'dayjs/plugin/timezone';
import Layout from "../../layout/Layout.astro";
import GoBackButton from '../../components/GoBackButton.astro';
Expand All @@ -9,9 +10,11 @@ import bookmarksJson from './_bookmarks.json';
const bookmarksData = bookmarksJson.data;
dayjs.extend(dayjsTimezone);
const groupByMonth = (bookmarks) => {
const grouped = bookmarks.reduce((acc, bookmark) => {
const month = dayjs(bookmark.savedAt).startOf('month').toISOString();
const month = dayjs.tz(bookmark.savedAt, 'America/Sao_Paulo').startOf('month').toISOString();
if (!acc[month]) {
acc[month] = [];
}
Expand Down

0 comments on commit 04850cc

Please sign in to comment.