Fix absolute timestring handler date sensitivity
This commit is contained in:
parent
9edce9160e
commit
09a2eb412b
1 changed files with 5 additions and 0 deletions
|
|
@ -516,6 +516,11 @@ def from_sophont_provided_data(data: str, user_tz: str = 'Etc/UTC') -> Either[Ex
|
||||||
>>> from_sophont_provided_data('2026-01-01', 'America/Chicago')
|
>>> from_sophont_provided_data('2026-01-01', 'America/Chicago')
|
||||||
Right[datetime](datetime(2026, 01, 02, 05, 59, 59, tzinfo=timezone.utc))
|
Right[datetime](datetime(2026, 01, 02, 05, 59, 59, tzinfo=timezone.utc))
|
||||||
'''
|
'''
|
||||||
|
data = re.sub(
|
||||||
|
'\\s+',
|
||||||
|
' ',
|
||||||
|
data # ensure any whitespace is reduced to single spaces
|
||||||
|
).upper().strip().replace(',', '')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tz = ZoneInfo(user_tz)
|
tz = ZoneInfo(user_tz)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue