guan404ming commented on code in PR #54370:
URL: https://github.com/apache/airflow/pull/54370#discussion_r2268603129
##########
airflow-core/src/airflow/ui/src/components/DateTimeInput.tsx:
##########
@@ -32,8 +32,11 @@ type Props = {
export const DateTimeInput = forwardRef<HTMLInputElement, Props>(({ onChange,
value, ...rest }, ref) => {
const { selectedTimezone } = useTimezone();
- // Make the value timezone-aware
- const date =
dayjs(value).tz(selectedTimezone).format("YYYY-MM-DDTHH:mm:ss.SSS");
+ // Make the value timezone-aware, handle invalid dates
+ const date =
+ value !== "" && dayjs(value).isValid()
Review Comment:
`isValid()` would handle `value == =""` case. Leaving one condition is
enough and clearer IMO.
```suggestion
dayjs(value).isValid()
```
--
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]