Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add task solution #2293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Andriana1112
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your implementation of the formatDate function is well-done and meets the task requirements effectively! 🎉 The function handles date format conversions correctly, including changing separators and reordering date parts. While there is a minor point regarding the assumption about the separator's position, it doesn't impact the core functionality. Keep up the great work, and consider adding checks for separator positions in future improvements to make your code even more robust. 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

function formatDate(date, fromFormat, toFormat) {
// write code here
function formatDate(dateStr, fromFormat, toFormat) {
const separator = fromFormat[3];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that fromFormat has at least four elements before accessing fromFormat[3]. If the format array is shorter, this will cause an error.

}
});

const newSeparator = toFormat[3];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that toFormat has at least four elements before accessing toFormat[3]. If the format array is shorter, this will cause an error.

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.

2 participants