-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 solution #2191
base: master
Are you sure you want to change the base?
add solution #2191
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.
Thank you for your hard work on this task! 😊 While your implementation of the formatDate
function is mostly correct and meets many of the task requirements, there are a couple of critical issues that need to be addressed before we can approve the pull request:
-
Year Conversion Logic: The current logic for converting two-digit years to four-digit years may not handle all cases correctly. For example, converting '29' to '2029' might not always be the intended behavior. It would be beneficial to add more robust logic to handle different century assumptions or provide a way for users to specify the century.
-
Delimiter Assumption: The code assumes that the fourth element in the
fromFormat
andtoFormat
arrays is the delimiter. This assumption might not hold true if the format arrays do not have exactly four elements. Consider implementing a check or a more flexible method to determine the delimiter.
Once these issues are resolved, your solution will be much stronger and ready for approval. Keep up the great work, and don't hesitate to reach out if you need any help! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
const [, , , slider] = fromFormat; | ||
const [, , , glue] = toFormat; |
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 code assumes that the fourth element in fromFormat
and toFormat
arrays is the delimiter. This assumption might not always hold true, especially if the format arrays do not have exactly four elements. Consider adding a check or a more flexible way to determine the delimiter.
if (normalDate[0].length <= 2 && toFormat.includes('YYYY')) { | ||
if (+normalDate[0] >= 30) { | ||
normalDate[0] = +normalDate[0] + 1900; | ||
} else { | ||
normalDate[0] = +normalDate[0] + 2000; | ||
} | ||
} else if (normalDate[0].length > 2 && toFormat.includes('YY')) { | ||
if (+normalDate[0] < 2000) { | ||
normalDate[0] = +normalDate[0] - 1900; | ||
} else { | ||
normalDate[0] = +normalDate[0] - 2000; | ||
} | ||
} |
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 logic for converting two-digit years to four-digit years and vice versa may not work correctly for all cases. For example, if the input year is '29', it will be converted to '2029', which might not be the intended behavior. Consider adding more robust logic to handle different century assumptions or provide a way for the user to specify the century.
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.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: 7]
If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.
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.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: 7]
If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.
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.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: 7]
If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.
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.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: 7]
If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.
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.
in general looks good
No description provided.