summaryrefslogtreecommitdiff
path: root/date-fns/src/addMonths/benchmark.js
blob: 13f52034e4561efe384a22d9a53a3616c66da809 (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 addMonths from '.'
import moment from 'moment'

suite('addMonths', function () {
  benchmark('date-fns', function () {
    return addMonths(this.date, 4)
  })

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