2016-08-07 15:09:59 -05:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const miscsUtils = {
|
2016-10-02 05:19:02 -05:00
|
|
|
dateIsValid
|
2016-08-07 15:09:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------- Export functions --------------------
|
|
|
|
|
|
|
|
function dateIsValid (dateString) {
|
|
|
|
const dateToCheck = new Date(dateString)
|
|
|
|
const now = new Date()
|
|
|
|
|
|
|
|
// Check if the interval is more than 2 minutes
|
|
|
|
if (now - dateToCheck > 120000) return false
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
module.exports = miscsUtils
|