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

import subMonths from '.'
import moment from 'moment'

suite('subMonths', function () {
  benchmark('date-fns', function () {
    return subMonths(this.date, 7)
  })

  benchmark('Moment.js', function () {
    return this.moment.subtract(7, 'months')
  })
}, {
  setup: function () {
    this.date = new Date()
    this.moment = moment()
  }
})