@@ -65,8 +65,12 @@ def calculate_years_and_months_to_traverse(
6565 This function is used when using the v1 calendar picker
6666 It calculates how many years and months it needs to traverse
6767 """
68- years_to_traverse = int (current_date .strftime ("%Y" )) - int (date .strftime ("%Y" ))
69- months_to_traverse = int (current_date .strftime ("%m" )) - int (date .strftime ("%m" ))
68+ years_to_traverse = int (DateTimeUtils .format_date (current_date , "%Y" )) - int (
69+ DateTimeUtils .format_date (date , "%Y" )
70+ )
71+ months_to_traverse = int (DateTimeUtils .format_date (current_date , "%m" )) - int (
72+ DateTimeUtils .format_date (date , "%m" )
73+ )
7074 return years_to_traverse , months_to_traverse
7175
7276 def traverse_years_in_v1_calendar (self , years_to_traverse : int ) -> None :
@@ -97,9 +101,9 @@ def select_day(self, date: datetime) -> None:
97101 It extracts the day from the date and then selects that value in the calendar picker
98102 """
99103 if platform == "win32" : # Windows
100- day_to_select = str ( date . strftime ( "%#d" ) )
104+ day_to_select = DateTimeUtils . format_date ( date , "%#d" )
101105 else : # Linux or Mac
102- day_to_select = str ( date . strftime ( "%-d" ) )
106+ day_to_select = DateTimeUtils . format_date ( date , "%-d" )
103107 number_of_cells_with_day = self .page .get_by_role (
104108 "cell" , name = day_to_select
105109 ).count ()
@@ -152,18 +156,18 @@ def calculate_v2_calendar_variables(
152156 current_century: the current century in yyyy format (e.g. 2000/2100)
153157 century: the wanted century in yyyy format (e.g. 1900)
154158 """
155- current_month_long = str ( current_date . strftime ( "%B" ) )
156- current_year = int (current_date . strftime ( "%Y" ))
159+ current_month_long = DateTimeUtils . format_date ( current_date , "%B" )
160+ current_year = int (DateTimeUtils . format_date ( current_date , "%Y" ))
157161 current_century = (current_year // 100 ) * 100
158162 current_decade = (
159163 ((current_year - current_century ) // 10 ) * 10
160164 ) + current_century
161165
162- year = int (date . strftime ( "%Y" ))
166+ year = int (DateTimeUtils . format_date ( date , "%Y" ))
163167 century = (year // 100 ) * 100
164168 decade = (((year - century ) // 10 ) * 10 ) + century
165- month_short = str ( date . strftime ( "%b" ) )
166- month_long = str ( date . strftime ( "%B" ) )
169+ month_short = DateTimeUtils . format_date ( date , "%b" )
170+ month_long = DateTimeUtils . format_date ( date , "%B" )
167171
168172 return (
169173 current_month_long ,
@@ -300,9 +304,9 @@ def book_first_eligble_appointment(
300304 current_month_displayed
301305 )
302306 if platform == "win32" : # Windows
303- current_month_int = int (datetime .now (). strftime ( "%#m" ))
307+ current_month_int = int (DateTimeUtils . format_date ( datetime .now (), "%#m" ))
304308 else : # Linux or Mac
305- current_month_int = int (datetime .now (). strftime ( "%-m" ))
309+ current_month_int = int (DateTimeUtils . format_date ( datetime .now (), "%-m" ))
306310
307311 self .book_appointments_go_to_month (
308312 current_month_displayed_int , current_month_int
0 commit comments