Skip to content

Commit 22c7638

Browse files
fix: use dateutil.parser for RFC 3339 timestamp parsing in on_schedule function
1 parent b6f9097 commit 22c7638

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/firebase_functions/scheduler_fn.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import firebase_functions.options as _options
3333
import firebase_functions.private.util as _util
3434
from firebase_functions.core import _with_init
35+
import dateutil.parser as dateutil_parser
3536

3637
# Re-export Timezone from options module so users can import it directly from scheduler_fn
3738
# This provides a more convenient API: from firebase_functions.scheduler_fn import Timezone
@@ -109,10 +110,6 @@ def on_schedule_wrapped(request: _Request) -> _Response:
109110
except ValueError as e:
110111
print(f"Failed to parse RFC 3339 timestamp: {e}")
111112
schedule_time = _dt.utcnow()
112-
schedule_time = _dt.datetime.strptime(
113-
schedule_time_str,
114-
"%Y-%m-%dT%H:%M:%S%z",
115-
)
116113
event = ScheduledEvent(
117114
job_name=request.headers.get("X-CloudScheduler-JobName"),
118115
schedule_time=schedule_time,

0 commit comments

Comments
 (0)