Repository: Hacker0x01/react-datepicker (ts)

Issue:
All options are selected for year picker
**Describe the bug**

https://github.com/user-attachments/assets/b69c38ef-e3fb-4a1c-8bcc-3f9bb3b16dfd

**To Reproduce**

Use a year picker with no value

**Expected behavior**

Options shouldn't have the selected style


Visible with latest version 8.3.0 (not seen with 8.2.1)

Pull request description:
Fix #5573 🐛 Fix the Selected Year Picker style when no date is selected
Closes #5573

## Description
As mentioned in the attached ticket, we're having an issue that the year picker is highlighting all the available years when do date is entered.  In this PR I added a fix for it along with the test cases to validate the fix.

## Contribution checklist
- [x] I have followed the [contributing guidelines](https://github.com/Hacker0x01/react-datepicker/blob/main/CONTRIBUTING.md).
- [x] I have added sufficient test coverage for my changes.
- [x] I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.


Patch:
diff --git a/src/year.tsx b/src/year.tsx
index 8bbfad18..5ac50998 100644
--- a/src/year.tsx
+++ b/src/year.tsx
@@ -248,7 +248,7 @@ export default class Year extends Component<YearProps> {
     if (selectsMultiple) {
       return selectedDates?.some((date) => year === getYear(date));
     }
-    return !selected || year === getYear(selected);
+    return !!selected && year === getYear(selected);
   };
 
   onYearClick = (


Test patch:
diff --git a/src/test/year_picker_test.test.tsx b/src/test/year_picker_test.test.tsx
index 440c9bc3..ef5e16d9 100644
--- a/src/test/year_picker_test.test.tsx
+++ b/src/test/year_picker_test.test.tsx
@@ -148,6 +148,20 @@ describe("YearPicker", () => {
     expect(yearElements.length).toBe(0);
   });
 
+  it("should not has selected class where there is no selectedDates", () => {
+    const { container } = render(
+      <Year
+        date={new Date()}
+        onYearMouseEnter={() => {}}
+        onYearMouseLeave={() => {}}
+      />,
+    );
+    const yearElements = Array.from(
+      container.querySelectorAll(".react-datepicker__year-text--selected"),
+    );
+    expect(yearElements.length).toBe(0);
+  });
+
   it("should have current year class when element of array equal of current year", () => {
     const date = new Date();
     const { container } = render(