diff --git a/client/app/components/sidebar/Sidebar.tsx b/client/app/components/sidebar/Sidebar.tsx
index 15ac8b5..31a59e0 100644
--- a/client/app/components/sidebar/Sidebar.tsx
+++ b/client/app/components/sidebar/Sidebar.tsx
@@ -2,7 +2,7 @@ import { ExternalLink, History, Home, Info } from "lucide-react";
import SidebarSearch from "./SidebarSearch";
import SidebarItem from "./SidebarItem";
import SidebarSettings from "./SidebarSettings";
-import { getRewindYear } from "~/utils/utils";
+import { getRewindParams, getRewindYear } from "~/utils/utils";
export default function Sidebar() {
const iconSize = 20;
@@ -45,7 +45,7 @@ export default function Sidebar() {
{}}
modal={<>>}
diff --git a/client/app/utils/utils.ts b/client/app/utils/utils.ts
index 50c0c16..79d9bc9 100644
--- a/client/app/utils/utils.ts
+++ b/client/app/utils/utils.ts
@@ -16,12 +16,15 @@ const timeframeToInterval = (timeframe: Timeframe): string => {
};
const getRewindYear = (): number => {
+ return new Date().getFullYear() - 1;
+};
+
+const getRewindParams = (): string => {
const today = new Date();
- if (today.getMonth() > 10 && today.getDate() >= 30) {
- // if we are in december 30/31, just serve current year
- return today.getFullYear();
+ if (today.getMonth() == 0) {
+ return `year=${today.getFullYear() - 1}`;
} else {
- return today.getFullYear() - 1;
+ return `month=${today.getMonth()}`;
}
};
@@ -114,5 +117,5 @@ const timeListenedString = (seconds: number) => {
return `${minutes} minutes listened`;
};
-export { hexToHSL, timeListenedString, getRewindYear };
+export { hexToHSL, timeListenedString, getRewindYear, getRewindParams };
export type { hsl };