Skip to content

Conversation

@saigusa-hisashi
Copy link

Why

Please describe why you are suggesting the PR.

What

Elaborate what your changes do, and how they address the problem described.

The original _exportDate function called `date.split('-')` before validating the format of the date string. This could lead to `month` or `day` variables being `undefined` if the date string was not in the expected format.

Passing `undefined` to the XML element's `append` method likely caused a runtime error, preventing the XML from being generated.

This commit refactors the function to only parse the year, month, and day from the date string after the string has been successfully validated against a corresponding format (YYYY-MM-DD, YYYY-MM, or YYYY). This prevents runtime errors from invalid date formats during XML export.
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