feat: add day of week to time result (#2580)
This commit is contained in:
parent
d59cb832ce
commit
60eb7c28ad
1 changed files with 4 additions and 0 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue