TimestampStrings allows ZoneInfo object as time_zone parameter

So we can use pre-parsed data

Some tests for parsing settings, timestamp output
This commit is contained in:
Clemens Schwaighofer
2025-09-25 15:14:40 +09:00
parent 14466c3ff8
commit 38bae7fb46
4 changed files with 13 additions and 3 deletions

View File

@@ -4,10 +4,12 @@
Test for double byte format
"""
from zoneinfo import ZoneInfo
from corelibs.string_handling.timestamp_strings import TimestampStrings
def main():
"""test"""
ts = TimestampStrings()
print(f"TS: {ts.timestamp_now}")
@@ -16,6 +18,11 @@ def main():
except ValueError as e:
print(f"Value error: {e}")
ts = TimestampStrings("Europe/Vienna")
print(f"TZ: {ts.time_zone} -> TS: {ts.timestamp_now_tz}")
ts = TimestampStrings(ZoneInfo("Europe/Vienna"))
print(f"TZ: {ts.time_zone} -> TS: {ts.timestamp_now_tz}")
if __name__ == "__main__":
main()