Skip to content

Commit

Permalink
make hour_only_tz work for any timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-genson committed Jul 4, 2024
1 parent 9331437 commit 7fe6132
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mealie/schema/_mealie/mealie_model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import re
from collections.abc import Sequence
from datetime import datetime, timezone
from enum import Enum
Expand All @@ -16,6 +17,8 @@

T = TypeVar("T", bound=BaseModel)

HOUR_ONLY_TZ_PATTERN = re.compile(r"[+-]\d{2}$")


class SearchType(Enum):
fuzzy = "fuzzy"
Expand Down Expand Up @@ -49,8 +52,7 @@ def fix_hour_only_tz(cls, data: T) -> T:
continue
except AttributeError:
continue
# this only works for UTC, but we enforce UTC throughout the entire application
if val.endswith("+00"):
if re.search(HOUR_ONLY_TZ_PATTERN, val):
setattr(data, field, val + ":00")

return data
Expand Down

0 comments on commit 7fe6132

Please sign in to comment.