Skip to content

Commit 38cc3b8

Browse files
Merge branch 'test/weekday-streak-simulation' of https://github.com/AryanRajuBankar3000/commitpulse into test/weekday-streak-simulation
2 parents 7d50770 + fad07af commit 38cc3b8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/api/streak/route.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ export async function GET(request: Request) {
106106
: year
107107
? `${year}-12-31T23:59:59Z`
108108
: undefined;
109+
const currentYear = new Date().getUTCFullYear();
110+
const isHistoricalYear = !!year && Number(year) < currentYear;
109111

110112
let timezone = 'UTC';
111113
if (tzParam) {
@@ -224,7 +226,9 @@ export async function GET(request: Request) {
224226
: getSecondsUntilUTCMidnight();
225227
const cacheControl = refresh
226228
? 'no-cache, no-store, must-revalidate'
227-
: `public, s-maxage=${secondsToMidnight}, stale-while-revalidate=86400`;
229+
: isHistoricalYear
230+
? 'public, s-maxage=31536000, immutable'
231+
: `public, s-maxage=${secondsToMidnight}, stale-while-revalidate=86400`;
228232

229233
return new NextResponse(svg, {
230234
headers: {

0 commit comments

Comments
 (0)