feat: add day of week to time result (#2580)

This commit is contained in:
Zehra Nur Olgun 2025-08-22 04:48:39 +02:00 • committed by GitHub
commit 60eb7c28ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,6 +22,7 @@ class TimeTools(str, Enum):
class TimeResult(BaseModel): class TimeResult(BaseModel):
timezone: str timezone: str
datetime: str datetime: str
day_of_week: str
is_dst: bool is_dst: bool
@ -64,6 +65,7 @@ class TimeServer:
return TimeResult( return TimeResult(
timezone=timezone_name, timezone=timezone_name,
datetime=current_time.isoformat(timespec="seconds"), datetime=current_time.isoformat(timespec="seconds"),
day_of_week=current_time.strftime("%A"),
is_dst=bool(current_time.dst()), is_dst=bool(current_time.dst()),
) )
@ -104,11 +106,13 @@ class TimeServer:
source=TimeResult( source=TimeResult(
timezone=source_tz, timezone=source_tz,
datetime=source_time.isoformat(timespec="seconds"), datetime=source_time.isoformat(timespec="seconds"),
day_of_week=source_time.strftime("%A"),
is_dst=bool(source_time.dst()), is_dst=bool(source_time.dst()),
), ),
target=TimeResult( target=TimeResult(
timezone=target_tz, timezone=target_tz,
datetime=target_time.isoformat(timespec="seconds"), datetime=target_time.isoformat(timespec="seconds"),
day_of_week=target_time.strftime("%A"),
is_dst=bool(target_time.dst()), is_dst=bool(target_time.dst()),
), ),
time_difference=time_diff_str, time_difference=time_diff_str,