From 38acabfa6089ab8ac469c12b5f55022fb96935e5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 23 Aug 2021 16:46:06 -0300 Subject: added web vendors --- date-fns/src/differenceInSeconds/benchmark.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 date-fns/src/differenceInSeconds/benchmark.js (limited to 'date-fns/src/differenceInSeconds/benchmark.js') diff --git a/date-fns/src/differenceInSeconds/benchmark.js b/date-fns/src/differenceInSeconds/benchmark.js new file mode 100644 index 0000000..ff52acf --- /dev/null +++ b/date-fns/src/differenceInSeconds/benchmark.js @@ -0,0 +1,23 @@ +// @flow +/* eslint-env mocha */ +/* global suite, benchmark */ + +import differenceInSeconds from '.' +import moment from 'moment' + +suite('differenceInSeconds', function () { + benchmark('date-fns', function () { + return differenceInSeconds(this.dateA, this.dateB) + }) + + benchmark('Moment.js', function () { + return this.momentA.diff(this.momentB, 'second') + }) +}, { + 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') + } +}) -- cgit v1.2.3