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 #2178

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

solution #2178

wants to merge 1 commit into from

Conversation

Blervin1
Copy link

@Blervin1 Blervin1 commented Dec 3, 2024

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! 🎉 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! ✨

Comment on lines +12 to +13
const separatorFrom = fromFormat[3];
const separatorTo = toFormat[3];

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

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;

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.

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