1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 69× 69× 69× | /** * Future date filter. Checks if a file's date occurs in the future. * @param {File} file File we're checking. * @param {Object} filterConfig Filter config object. * @return {boolean} If the File's date is in the future */ export default function futureDatesFilter(file, filterConfig = {}) { let dateKey = filterConfig.key || 'date'; let fileDate = new Date(file.data[dateKey]).getTime(); // If the date is in the future we have a positive number. return (fileDate - Date.now()) > 0; } |