Skip to content

Conversation

@winnyboy5
Copy link

The DateUtil.clone function previously relied on date.getTime(), which would throw an error if date was not a valid Date object. This could occur if a string, number, or other unexpected data type was passed to the function.

This commit makes DateUtil.clone more robust by handling non-Date objects. The function now checks if the input date is a string. If so, it attempts to parse the string into a Date object using Date.parse(). This allows the function to handle date strings correctly.

This change prevents runtime errors and improves the reliability of DateUtil.clone when dealing with various input types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant