Lee-W commented on code in PR #70249:
URL: https://github.com/apache/airflow/pull/70249#discussion_r4386530614


##########
airflow-ctl/src/airflowctl/ctl/cli_config.py:
##########
@@ -216,6 +216,33 @@ def json_dict_type(val: str | dict[str, Any]) -> dict[str, 
Any]:
     return parsed
 
 
+def iso_datetime_type(val: str | datetime.datetime) -> datetime.datetime:
+    """Parse an ISO-8601 datetime argument."""
+    if isinstance(val, datetime.datetime):
+        return val
+    try:
+        if val.endswith("Z"):
+            val = val[:-1] + "+00:00"
+        return datetime.datetime.fromisoformat(val)
+    except ValueError as e:
+        raise argparse.ArgumentTypeError(f"invalid datetime value: {val!r}") 
from e
+
+
+def iso_date_type(val: str | datetime.date) -> datetime.date:

Review Comment:
   ```suggestion
   def is_iso_date_type(val: str | datetime.date) -> datetime.date:
   ```



##########
airflow-ctl/src/airflowctl/ctl/cli_config.py:
##########
@@ -216,6 +216,33 @@ def json_dict_type(val: str | dict[str, Any]) -> dict[str, 
Any]:
     return parsed
 
 
+def iso_datetime_type(val: str | datetime.datetime) -> datetime.datetime:

Review Comment:
   ```suggestion
   def is_iso_datetime_type(val: str | datetime.datetime) -> datetime.datetime:
   ```



-- 
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]

Reply via email to