Skip to content

Commit

Permalink
add current year as default value
Browse files Browse the repository at this point in the history
  • Loading branch information
kresnasatya committed Dec 27, 2024
1 parent e38e13e commit eb87923
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion functions/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function onRequest(context) {

// Get query parameters using URLSearchParams
const month = url.searchParams.get('month') || '';
const year = url.searchParams.get('year') || '';
const year = url.searchParams.get('year') || (new Date()).getFullYear();
let response = new Response(JSON.stringify({ year, month }));

response.headers.set('Cache-Control', 'public, max-age=0, s-maxage=86400');
Expand Down

0 comments on commit eb87923

Please sign in to comment.