2016-08-07 22:09:59 +02:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const miscsUtils = {
|
2016-10-02 12:19:02 +02:00
|
|
|
dateIsValid
|
2016-08-07 22:09:59 +02: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
|