Skip to content

Commit

Permalink
Fix date setting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaschlegel committed Oct 31, 2024
1 parent 96bc5b9 commit 40d7d0a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/components/CurrentYear.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
'use client';
import { useEffect, useState } from 'react';

export default function CurrentYear() {
return new Date().getFullYear().toString();
const [currentYear, setCurrentYear] = useState('');

useEffect(() => {
setCurrentYear(new Date().getFullYear().toString());
}, []);

return currentYear;
}

0 comments on commit 40d7d0a

Please sign in to comment.