From 8e3f646dec42dccf4dea5efe51f0c662cca4fa60 Mon Sep 17 00:00:00 2001 From: Andreas Deuschlinger Date: Thu, 29 Aug 2024 08:05:46 +0200 Subject: [PATCH] chore: upgrade date-fns to v3 --- package.json | 2 +- src/utils.js | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index b24ca14..6af04eb 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "dependencies": { "@babel/runtime": "^7.6.2", - "date-fns": "^2.0.0" + "date-fns": "^3.6.0" }, "eslintConfig": { "extends": "./node_modules/kcd-scripts/eslint.js" diff --git a/src/utils.js b/src/utils.js index dc43a82..8af69e4 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,8 +1,8 @@ -import addDays from 'date-fns/addDays'; -import isBefore from 'date-fns/isBefore'; -import isToday from 'date-fns/isToday'; -import startOfDay from 'date-fns/startOfDay'; -import differenceInCalendarMonths from 'date-fns/differenceInCalendarMonths'; +import { addDays } from 'date-fns/addDays'; +import { isBefore } from 'date-fns/isBefore'; +import { isToday } from 'date-fns/isToday'; +import { startOfDay } from 'date-fns/startOfDay'; +import { differenceInCalendarMonths } from 'date-fns/differenceInCalendarMonths'; /** * This is intended to be used to compose event handlers @@ -15,7 +15,9 @@ import differenceInCalendarMonths from 'date-fns/differenceInCalendarMonths'; export function composeEventHandlers(...fns) { return (event, ...args) => fns.some(fn => { - fn && fn(event, ...args); + if (fn) { + fn(event, ...args); + } return event.defaultPrevented; }); }