Remove some instances of moment that are not needed on the index to reduce the load

This commit is contained in:
nitsua
2020-09-30 13:26:00 -04:00
committed by Qstick
parent 82eadcffaa
commit 5b83d09d5e
5 changed files with 21 additions and 12 deletions

View File

@@ -1,11 +1,13 @@
import moment from 'moment';
function isTomorrow(date) {
if (!date) {
return false;
}
return moment(date).isSame(moment().add(1, 'day'), 'day');
const dateObj = (typeof date === 'object') ? date : new Date(date);
const today = new Date();
const tomorrow = new Date((today.setDate(today.getDate() + 1)));
return dateObj.getDate() === tomorrow.getDate() && dateObj.getMonth() === tomorrow.getMonth() && dateObj.getFullYear() === tomorrow.getFullYear();
}
export default isTomorrow;