Repository: vacanza/holidays

Issue:
Support retrieving weekend days per country
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
When determining whether a day is a working day, we can't find out if a day is a weekend if it's not a working day and not a holiday, since some holidays fall on weekends. We're not able to check the specific dates we would need for our purposes

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
Given a date, return True if it's a weekend, return False if it isn't
us_calendar.is_weekend(Date(2024-05-05)) -> True
us_calendar.is_weekend(Date(2024-05-06)) -> False

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
Creating a dictionary locally where we maintain the weekends per country and check them
Check is_working_day False but and is_holiday False -> May have logical issues

**Additional context**
Add any other context or screenshots about the feature request here.
Falls within the scope of holidays because weekends are holidays as well, and are currently considered in calculations for working days and holidays, albeit indirectly


Discussion:
There is a private [method](https://github.com/vacanza/holidays/blob/630f57af374190311900f6c1feb3a0efded4e2d7/holidays/holiday_base.py#L892) `HolidayBase::_is_weekend`.
Can we maybe make that method public? And thereby support checking weekends officially?
Any updates?



Patch:
diff --git a/holidays/holiday_base.py b/holidays/holiday_base.py
index 5e1ec9e66c..80119d41ff 100644
--- a/holidays/holiday_base.py
+++ b/holidays/holiday_base.py
@@ -1135,6 +1135,20 @@ def get_working_days_count(self, start: DateLike, end: DateLike) -> int:
         days = (dt2 - dt1).days + 1
         return sum(self.is_working_day(_timedelta(dt1, n)) for n in range(days))
 
+    def is_weekend(self, key: DateLike) -> bool:
+        """Check if the given date's week day is a weekend day.
+
+        Args:
+            key:
+                The date to check.
+
+        Returns:
+            True if the date's week day is a weekend day, False otherwise.
+        """
+        # To prioritize performance we avoid reusing the internal
+        # `HolidayBase._is_weekend` method and perform the check directly instead.
+        return self.__keytransform__(key).weekday() in self.weekend
+
     def is_working_day(self, key: DateLike) -> bool:
         """Check if the given date is considered a working day.
 


Test patch:
diff --git a/tests/test_holiday_base.py b/tests/test_holiday_base.py
index c191a86e81..b86a814d4a 100644
--- a/tests/test_holiday_base.py
+++ b/tests/test_holiday_base.py
@@ -696,6 +696,29 @@ def _populate(self, year):
         self.assertIn("2020-07-13", hb)
 
 
+class TestIsWeekend(unittest.TestCase):
+    def setUp(self):
+        self.hb = CountryStub1()
+
+    def test_is_weekend(self):
+        self.hb._populate(2022)
+
+        self.hb.weekend = {MON, TUE}
+        for dt in (date(2022, 10, 3), date(2022, 10, 4), "2022-10-03", "2022-10-04"):
+            self.assertTrue(self.hb.is_weekend(dt))
+
+        self.hb.weekend = set()
+        for dt in (date(2022, 10, 3), date(2022, 10, 4), "2022-10-03", "2022-10-04"):
+            self.assertFalse(self.hb.is_weekend(dt))
+
+        self.hb.weekend = {SAT, SUN}
+        for dt in (date(2022, 10, 1), date(2022, 10, 2), "2022-10-01", "2022-10-02"):
+            self.assertTrue(self.hb.is_weekend(dt))
+
+        for dt in (date(2022, 10, 3), date(2022, 10, 4), "2022-10-03", "2022-10-04"):
+            self.assertFalse(self.hb.is_weekend(dt))
+
+
 class TestKeyTransforms(unittest.TestCase):
     def setUp(self):
         self.hb = CountryStub1()