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

suite('setMilliseconds', function () {
  benchmark('date-fns', function () {
    return setMilliseconds(this.date, 400)
  })

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