mandeepzemo commented on issue #54935:
URL: https://github.com/apache/airflow/issues/54935#issuecomment-3232922085
Hi Team,
I made the following changes in the **temporal.py** to handle string inputs
for moment and ensure proper datetime validation:
```
def __init__(self, moment: datetime.datetime, *, end_from_trigger: bool =
False) -> None:
super().__init__()
if isinstance(moment, str):
try:
moment = datetime.datetime.fromisoformat(moment)
except (ValueError, TypeError) as e:
raise ValueError(f"Invalid datetime string format. Expected ISO
format. Error: {e}")
elif not isinstance(moment, datetime.datetime):
raise TypeError(f"Expected datetime.datetime type for moment. Got
{type(moment)}")
# Make sure it's in UTC
if moment.tzinfo is None:
raise ValueError("You cannot pass naive datetimes")
self.moment: pendulum.DateTime = timezone.convert_to_utc(moment)
self.end_from_trigger = end_from_trigger
```
This fix resolved the error:
`Expected datetime.datetime type for moment. Got <class 'str'>`
However, after this change, the task is still getting deferred (screenshot
attached below).
Could you please confirm if this is the expected behavior, or if additional
changes are required to prevent the deferral?
Thanks in advance for your guidance.
<img width="1822" height="858" alt="Image"
src="https://github.com/user-attachments/assets/49027b2d-16ba-4c55-a2a4-e700a8cab26a"
/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]