Skip to content

Commit

Permalink
perf: fix benchmark for date-fns@2
Browse files Browse the repository at this point in the history
  • Loading branch information
standy committed Feb 13, 2020
1 parent 14d7fca commit 6398ef6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion benchmark/suites/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const moment = require('moment');
const dateFns = require('date-fns');

const pattern = 'dddd, MMMM Do YYYY, [escaped], h:mm:ss a';
const patternUTS = `EEEE, MMMM Do yyyy, 'escaped', h:mm:ss a`;
let date;
let dateMoment;

Expand All @@ -26,7 +27,7 @@ suite
return dateMoment.format(pattern);
}, {onCycle})
.add(names.dateFns, function() {
return dateFns.format(date, pattern);
return dateFns.format(date, patternUTS);
}, {onCycle})
.add(names.tsDatePrev, function() {
return tsDatePrev.format(date, pattern);
Expand Down
2 changes: 1 addition & 1 deletion benchmark/suites/parse-iso.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ suite
return moment(dateStr);
}, {onCycle})
.add(names.dateFns, function() {
return dateFns.parse(dateStr);
return dateFns.parseISO(dateStr);
}, {onCycle})
.add(names.tsDatePrev, function() {
return tsDatePrev.parseIso(dateStr);
Expand Down

0 comments on commit 6398ef6

Please sign in to comment.