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

import sub from '.'
import moment from 'moment'

suite(
  'add',
  function() {
    benchmark('date-fns', function() {
      return sub(this.date, { hours: 5, minutes: 10 })
    })

    benchmark('Moment.js', function() {
      return this.moment.subtract({ hours: 5, minutes: 10 })
    })
  },
  {
    setup: function() {
      this.date = new Date()
      this.moment = moment()
    }
  }
)