summaryrefslogtreecommitdiff
path: root/date-fns/src/isAfter/benchmark.js
blob: 6a9cbc0d301d3904fa191900891cc3c674d2bbb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// @flow
/* eslint-env mocha */
/* global suite, benchmark */

import isAfter from '.'
import moment from 'moment'

suite('isAfter', function () {
  benchmark('date-fns', function () {
    return isAfter(this.dateA, this.dateB)
  })

  benchmark('Moment.js', function () {
    return this.momentA.isAfter(this.momentB)
  })
}, {
  setup: function () {
    this.dateA = new Date()
    this.momentA = moment()
    this.dateB = new Date(this.dateA.getTime() + 604800000)
    this.momentB = this.momentA.clone().add(7, 'days')
  }
})