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
+4 -3
View File
@@ -1,11 +1,12 @@
import moment from 'moment';
function isToday(date) {
if (!date) {
return false;
}
return moment(date).isSame(moment(), 'day');
const dateObj = (typeof date === 'object') ? date : new Date(date);
const today = new Date();
return dateObj.getDate() === today.getDate() && dateObj.getMonth() === today.getMonth() && dateObj.getFullYear() === today.getFullYear();
}
export default isToday;