-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Каширин Максим #30
base: master
Are you sure you want to change the base?
Каширин Максим #30
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.
Хорошо, но может быть лучше и аккуратнее
formatDate.js
Outdated
// Напишите код форматирования даты в этом месте | ||
const moths = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'] | ||
|
||
function formatDate(date1) { |
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.
Странное название аргумента «date1»
formatDate.js
Outdated
else | ||
var hours = date.getUTCHours(); | ||
if (date.getUTCMinutes() < 10) | ||
var minutes = '0' + date.getUTCMinutes(); |
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.
Можно вынести добавление 0 в хэлпер
formatDate.js
Outdated
return 'вчера в '+ hours + ':' + minutes; | ||
} | ||
if (date.getFullYear() < curYear) | ||
return date.getUTCDate() + ' ' + moths[date.getUTCMonth()] + ' ' + date.getFullYear() + ' года в ' + hours + ':'+ minutes; |
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.
Вызовы .getUTC* можно закэшировать в переменную
tests/formatDate-test.js
Outdated
|
||
|
||
|
||
it ('should throw error when arguments number is 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.
Нет проверки что аргументов не может быть больше 1
tests/formatDate-test.js
Outdated
assert.equal(actual, "31 января 2000 года в 11:59"); | ||
}); | ||
|
||
it('should return `31 декабря 1999 года в 23:59` for `1999-12-31T10:59:59.999Z`', () => { |
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.
Зачем этот тест?
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.
Ок
No description provided.