aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/miscs.js
blob: 5414cd56161f9ce3b7326c9d19e095a002dcf946 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict'

const miscsUtils = {
  dateIsValid: dateIsValid
}

// ---------------------- 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