-
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
solution #2178
base: master
Are you sure you want to change the base?
solution #2178
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 some assumptions in your code regarding the separator and the order of date components, these do not critically impact the functionality for the given task requirements. In future projects, consider adding error handling and making your code more flexible to handle different formats dynamically. Keep up the good work and continue to refine your skills! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
const separatorFrom = fromFormat[3]; | ||
const separatorTo = toFormat[3]; |
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 assumption that the separator is always at index 3 in both fromFormat
and toFormat
arrays may not be correct. You should determine the separator dynamically or ensure that the format arrays are structured to include the separator explicitly.
const newFormat = []; | ||
const separatorFrom = fromFormat[3]; | ||
const separatorTo = toFormat[3]; | ||
const numbers = date.split(separatorFrom); |
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 split
method assumes that the separator is correct and present in the date string. Consider adding error handling to manage cases where the separator is incorrect or missing.
const separatorFrom = fromFormat[3]; | ||
const separatorTo = toFormat[3]; | ||
const numbers = date.split(separatorFrom); | ||
let [year, month, day] = numbers; |
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 initial assignment of year
, month
, and day
assumes a specific order in the numbers
array. This may not be correct if the fromFormat
is different. Ensure that the assignment matches the fromFormat
specification.
No description provided.