Fix datetime string in localtime (better fix)
This commit is contained in:
parent
421d53ec28
commit
d144127c39
1 changed files with 1 additions and 3 deletions
|
@ -206,9 +206,7 @@ def timedelta_to_offset_string(timed: datetime.timedelta):
|
||||||
seconds = timed.days * 24 * 60 * 60 + timed.seconds
|
seconds = timed.days * 24 * 60 * 60 + timed.seconds
|
||||||
minutes_offset = int(seconds / 60)
|
minutes_offset = int(seconds / 60)
|
||||||
hours_offset = int(minutes_offset / 60)
|
hours_offset = int(minutes_offset / 60)
|
||||||
minutes_offset = minutes_offset - hours_offset * 60
|
minutes_offset = abs(minutes_offset - hours_offset * 60)
|
||||||
if minutes_offset < 0:
|
|
||||||
minutes_offset += 60
|
|
||||||
return f"{hours_offset:+03d}:{minutes_offset:02d}"
|
return f"{hours_offset:+03d}:{minutes_offset:02d}"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue