IB

Size: a a a
IB
j
const getDaysBetweenDates = function (date1, date2) {
if (arguments.length < 2) {
throw TypeError('Wrong arguments')
}
...
IB
const getDaysBetweenDates = function (date1, date2) {
if (arguments.length < 2) {
throw TypeError('Wrong arguments')
}
...
j
IB
j
const getDaysBetweenDates = (...args) => {Вроде того
if (args.length < 2) {
throw TypeError('Wrong arguments')
}
const [date1, date2] = args;
...
IB
j
const getDaysBetweenDates = (date1, date2) => {
const MS_PER_DAY = 1000 * 60 * 60 * 24;
const a = new Date(date1)
const b = new Date(date2)
const utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
const utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());
return Math.floor((utc2 - utc1) / MS_PER_DAY, 0);
};
Math.floor((a - b) / MS_PER_DAY)
IB
Math.floor((a - b) / MS_PER_DAY)
j
j
j
MK
j
IB
IB
j
j
j
IB