11from datetime import datetime , timedelta
2+ from typing import Optional
23import random
34
45
@@ -46,27 +47,18 @@ def add_days(date: datetime, days: float) -> datetime:
4647 return date + timedelta (days = days )
4748
4849 @staticmethod
49- def get_day_of_week_for_today (date : datetime ) -> str :
50- """Gets the day of the week (e.g., Monday, Tuesday) from the specified date.
51-
52- Args:
53- date (datetime): The current date using the now function
54-
55- Returns:
56- str: The day of the week relating to the specified date.
50+ def get_day_of_week (date : Optional [datetime ] = None ) -> str :
5751 """
58- return date .strftime ("%A" )
59-
60- @staticmethod
61- def get_a_day_of_week (date : datetime ) -> str :
62- """Gets the day of the week (e.g., Monday, Tuesday) from the specified date.
52+ Returns the day of the week (e.g., Monday, Tuesday) for the given date.
53+ If no date is provided, uses today’s date.
6354
6455 Args:
65- date (datetime): The date for which the day of the week will be returned .
56+ date (Optional[ datetime] ): The date to inspect. Defaults to now .
6657
6758 Returns:
68- str: The day of the week relating to the specified date.
59+ str: Day of week corresponding to the date.
6960 """
61+ date = date or datetime .now ()
7062 return date .strftime ("%A" )
7163
7264 @staticmethod
@@ -99,7 +91,8 @@ def screening_practitioner_appointments_report_timestamp_date_format() -> str:
9991
10092 return DateTimeUtils .format_date (datetime .now (), "%d.%m.%Y at %H:%M:%S" )
10193
102- def month_string_to_number (self , string : str ) -> int :
94+ @staticmethod
95+ def month_string_to_number (string : str ) -> int :
10396 """
10497 This is used to convert a month from a string to an integer.
10598 It accepts the full month or the short version and is not case sensitive
@@ -126,7 +119,8 @@ def month_string_to_number(self, string: str) -> int:
126119 except Exception :
127120 raise ValueError ("Not a month" )
128121
129- def generate_unique_weekday_date (self , start_year : int = 2025 ) -> str :
122+ @staticmethod
123+ def generate_unique_weekday_date (start_year : int = 2025 ) -> str :
130124 """
131125 Generates a future weekday date from the specified year onward.
132126
0 commit comments