|
|
|
@ -330,35 +330,16 @@ class Match(TournamentSubModel): |
|
|
|
else: |
|
|
|
else: |
|
|
|
return 'À suivre' |
|
|
|
return 'À suivre' |
|
|
|
else: |
|
|
|
else: |
|
|
|
# Get the tournament and timezone |
|
|
|
# timezoned_datetime = timezone.localtime(self.start_date) |
|
|
|
tournament = self.get_tournament() |
|
|
|
timezone = self.get_tournament().timezone() |
|
|
|
timezone = tournament.timezone() |
|
|
|
|
|
|
|
local_start = self.start_date.astimezone(timezone) |
|
|
|
local_start = self.start_date.astimezone(timezone) |
|
|
|
|
|
|
|
time_format ='l H:i' |
|
|
|
if tournament.day_duration >= 7: |
|
|
|
if self.get_tournament().day_duration >= 7: |
|
|
|
# Use the custom month property from tournament |
|
|
|
time_format = 'D. d F à H:i' |
|
|
|
# First create a date object with the same date as local_start |
|
|
|
|
|
|
|
# so we can use tournament's week_day and month properties |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Format the hour and minute |
|
|
|
|
|
|
|
hour = local_start.hour |
|
|
|
|
|
|
|
minute = local_start.minute |
|
|
|
|
|
|
|
time_str = f"{hour:02d}:{minute:02d}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Create the formatted date string using tournament properties and local_start |
|
|
|
|
|
|
|
weekday = formats.date_format(local_start, format='D') + '.' # Abbreviated weekday with period |
|
|
|
|
|
|
|
day = local_start.day |
|
|
|
|
|
|
|
month = tournament.month # Use the custom month property |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
formatted_date = f"{weekday} {day} {month} à {time_str}" |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
# For shorter durations, just use the weekday and time |
|
|
|
|
|
|
|
formatted_date = formats.date_format(local_start, format='l H:i') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.confirmed: |
|
|
|
if self.confirmed: |
|
|
|
return formatted_date |
|
|
|
return formats.date_format(local_start, format=time_format) |
|
|
|
else: |
|
|
|
else: |
|
|
|
return f"Estimée : {formatted_date}" |
|
|
|
return f"Estimée : {formats.date_format(local_start, format=time_format)}" |
|
|
|
else: |
|
|
|
else: |
|
|
|
return 'À venir...' |
|
|
|
return 'À venir...' |
|
|
|
|
|
|
|
|
|
|
|
|