def _cal_weekday_num(self, day: date | datetime) -> int:
        """Number of day of week for the given date.

        Evaluates a date against week_start and cal_weekend options and returns
        a day number starting from sunday=0 or monday=0."""
        day_num = int(day.strftime('%w'))
        if (self.options['week_start'] == config.WeekStart.MONDAY
                or not self.options['cal_weekend']):
            # Shift to count starting from monday (subtract 1, mod 7)
            day_num = (day_num - 1 + 7) % 7
        return day_num
Number of day of week for the given date.

        Evaluates a date against week_start and cal_weekend options and returns
        a day number starting from sunday=0 or monday=0.
gcalcli/gcal.py