-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
base: master
Are you sure you want to change the base?
add task solution #2219
Conversation
There was a problem hiding this 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this 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; |
There was a problem hiding this comment.
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.
No description provided.