-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Develop #1915
base: master
Are you sure you want to change the base?
Develop #1915
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job.
Check small comments)
Thanks
src/formatDate.js
Outdated
if (fromFormat[yearIndex] === 'YY') { | ||
if (parseInt(year) <= currentYear) { | ||
year = '20' + year.padStart(2, '0'); | ||
} else { | ||
year = '19' + year.padStart(2, '0'); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move all formats (YYYY,YY) to constant.
Also move all number values (20, 19) to constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good for now 👍
However, please, avoid using string literals and magic numbers directly as a part of the logic. Such values should be constants (pls see my comment)
const dayIndex = fromFormat.indexOf('DD'); | ||
const monthIndex = fromFormat.indexOf('MM'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DD
and MM
also should be constants
No description provided.