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 #2219

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

Conversation

kirill-mate
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.

Great job on implementing the formatDate function! 🎉 While there are a few minor issues, such as the incorrect use of the includes method instead of indexOf, these do not significantly impact the overall functionality. Your solution meets the task requirements effectively. Keep up the good work, and consider refining those small details for even better code quality in the future! 😊

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

if (fromFormat.indexOf('DD') !== toFormat.indexOf('DD')) {
resultDate[toFormat.indexOf('DD')] = day;
resultDate[toFormat.indexOf('MM')] = month;
resultDate[toFormat.includes(yearFormat)] = year;

Choose a reason for hiding this comment

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

The line resultDate[toFormat.includes(yearFormat)] = year; is incorrect. The includes method returns a boolean, not an index. You should use toFormat.indexOf(yearFormat) to get the correct index for the year.

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.

Great job on implementing the formatDate function! 🎉 The logic for handling date formats and conversions is well-structured and meets the task requirements. While there was a minor issue with using includes instead of indexOf for the year reassignment, it doesn't significantly impact the overall functionality. Keep up the good work, and consider this feedback for future improvements. 😊

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

if (fromFormat.indexOf('DD') !== toFormat.indexOf('DD')) {
resultDate[toFormat.indexOf('DD')] = day;
resultDate[toFormat.indexOf('MM')] = month;
resultDate[toFormat.includes(yearFormat)] = year;

Choose a reason for hiding this comment

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

The line resultDate[toFormat.includes(yearFormat)] = year; is incorrect. The includes method returns a boolean, so using it as an index will not work as intended. You should use toFormat.indexOf(yearFormat) to get the correct index for the year in the toFormat array.

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