Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ const baseStreakParamsSchema = z.object({
(val) => {
if (!val) return true;
const yearNum = parseInt(val, 10);
const currentYear = new Date().getFullYear();
const currentYear = new Date().getUTCFullYear();
return /^\d{4}$/.test(val) && yearNum >= 2008 && yearNum <= currentYear;
},
{
Expand Down Expand Up @@ -672,7 +672,7 @@ export const wrappedParamsSchema = z.object({
(val) => {
if (!val) return true;
const yearNum = parseInt(val, 10);
const currentYear = new Date().getFullYear();
const currentYear = new Date().getUTCFullYear();
return /^\d{4}$/.test(val) && yearNum >= 2008 && yearNum <= currentYear;
},
{
Expand Down
2 changes: 1 addition & 1 deletion lib/validations.year.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { streakParamsSchema, wrappedParamsSchema } from './validations';

const CURRENT_YEAR = new Date().getFullYear();
const CURRENT_YEAR = new Date().getUTCFullYear();
const EXPECTED_ERROR = 'GitHub was founded in 2008. Please provide a year of 2008 or later.';

function getYearError(result: {
Expand Down
Loading