-
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 #2236
base: master
Are you sure you want to change the base?
Solution #2236
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! 🎉 It meets the task requirements and handles date conversions effectively. Just a small note: the code assumes the delimiter is always at the fourth position in the format arrays, which might not always be the case. Consider dynamically determining the delimiter position for more flexibility. Keep up the excellent work! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
@@ -8,7 +8,45 @@ | |||
* @returns {string} | |||
*/ | |||
function formatDate(date, fromFormat, toFormat) { | |||
// write code here | |||
function extractDateParts(date, format) { | |||
const parts = date.split(format[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 code assumes that the delimiter is always at the fourth position in the fromFormat
array. This assumption may not hold true if the format array is structured differently. Consider dynamically determining the delimiter position or ensuring the format array is structured as expected.
result += part; | ||
|
||
if (i < toFormat.length - 2) { | ||
result += 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.
Similar to the issue in line 12, this line assumes the delimiter is at the fourth position in the toFormat
array. Ensure that the format array is structured correctly or dynamically determine the delimiter position.
No description provided.