Skip to content

Commit

Permalink
add sameyear fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando Colom committed Jan 16, 2025
1 parent b6358cb commit 34cf5e1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/helpers/isSameYear.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { isSameYear as sameYear } from 'date-fns';

/**
* The function `isSameYear` checks if two dates are on the same day.
* @param {Date} earlierDate - The `earlierDate` parameter represents the date that occurs earlier in time
* @param {Date} laterDate - A date representing a later point in time.
* when comparing two dates.
* @return {boolean}
*/
const isSameYear = (earlierDate, laterDate) => sameYear(laterDate, earlierDate, { in: true });

export default isSameYear;

0 comments on commit 34cf5e1

Please sign in to comment.