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

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

Solution #2187

wants to merge 1 commit into from

Conversation

khassan-d
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 the conversion between date formats effectively. While there are a few areas for improvement, such as clarifying the handling of the 'YY' format and ensuring robust handling of input cases, these do not significantly impact the core functionality. Keep up the good work, and consider the feedback for future enhancements! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +43 to +46
if (dateNumbers[i] < 30) {
dateObj.year = `20${dateNumbers[i]}`;
} else {
dateObj.year = `19${dateNumbers[i]}`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for determining the century for 'YY' format assumes that any year less than 30 belongs to the 2000s, and any year 30 or greater belongs to the 1900s. This is a common heuristic but may not be universally applicable. Consider making this logic configurable or document this assumption clearly.

const fromFormatArray = [aFrom, bFrom, cFrom];
const [aTo, bTo, cTo, newSeparator] = toFormat;
const toFormatArray = [aTo, bTo, cTo];
const dateinNumbers = date.split(separator);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the date string contains the expected number of segments when split by separator. If the date string does not match the expected format, this could lead to unexpected behavior or errors.


const dateInfo = getDateFromOld(fromFormatArray, dateinNumbers);

return setDateOrderNew(toFormatArray, dateInfo).join(newSeparator);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setDateOrderNew function assumes that dateInfo contains all necessary date parts. Ensure that getDateFromOld correctly populates dateInfo with all required fields, or handle cases where some fields might be missing.

Copy link

@etojeDenys etojeDenys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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.

3 participants