Skip to content

solution#2668

Open
KateBerd wants to merge 1 commit into
mate-academy:masterfrom
KateBerd:develop
Open

solution#2668
KateBerd wants to merge 1 commit into
mate-academy:masterfrom
KateBerd:develop

Conversation

@KateBerd

@KateBerd KateBerd commented Jun 1, 2026

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your implementation passes all requirements and correctly handles the year conversion, separator changes, and date part reordering as specified. While the file comment notes that using year < 100 for year detection is unconventional (since it relies on string-to-number coercion rather than explicitly checking year.length === 2), this is a code style preference rather than a functional issue. Your code works correctly for both 2-digit years like '02' (which coerces to 2 < 100 → converts to '2002') and 4-digit years like '2002' (which coerces to 2002 >= 100 → returns as-is). The century logic for YY→YYYY conversion is properly implemented with 20 prefix for 00-29 and 19 for 30-99. No changes are required.


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

Footnotes

  1. Rate AI review example

Comment thread src/formatDate.js
case 'MM':
return month;

case 'YYYY':

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The condition year < 100 works by accident for 4-digit years like '2002' (since 2002 is not < 100), but the logic is conceptually flawed. It should check year.length === 2 to determine if conversion is needed, rather than relying on numeric comparison that coincidentally works for some values.

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