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

Solution #2236

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

Solution #2236

wants to merge 1 commit into from

Conversation

GDm1triy
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! 🎉 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]);

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];

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.

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