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 applied #2179

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

Conversation

taniakolesnik
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! 🎉 Your solution meets the task requirements and constraints effectively. While there are a couple of minor issues regarding the conversion of two-digit years and handling separators, these do not significantly impact the functionality. Keep up the good work, and consider the feedback for future improvements! 😊

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

Comment on lines +11 to +12
const oldSeparator = fromFormat.pop();
const newSeparator = toFormat.pop();

Choose a reason for hiding this comment

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

Popping the last element from fromFormat and toFormat to get the separators might not be reliable if the formats don't end with the separator. Consider explicitly passing the separator as a separate argument or ensuring the format arrays are structured to include separators as the last element.


if (key === 'YY' && toFormat.includes('YYYY')) {
key = 'YYYY';
value = parseInt(value) < 30 ? 20 + value : 19 + value;

Choose a reason for hiding this comment

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

The logic for converting two-digit years to four-digit years is incorrect. The expression 20 + value and 19 + value will concatenate strings instead of adding numbers. Use parseInt(value, 10) to ensure numeric addition.

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