Files
klz-cables.com/.pnpm-store/v10/files/48/5dd98fb0df1b7327d010b894d4f377bcd32566756fed0b806d20912ebc99c547dff978e095feb8eac4b150268a8861df0e7dec0556d1a1dbe7f230b4aaa078
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

31 lines
956 B
Plaintext

import { toDate } from "./toDate.mjs";
/**
* @name isSameYear
* @category Year Helpers
* @summary Are the given dates in the same year?
*
* @description
* Are the given dates in the same year?
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
* @param dateLeft - The first date to check
* @param dateRight - The second date to check
*
* @returns The dates are in the same year
*
* @example
* // Are 2 September 2014 and 25 September 2014 in the same year?
* const result = isSameYear(new Date(2014, 8, 2), new Date(2014, 8, 25))
* //=> true
*/
export function isSameYear(dateLeft, dateRight) {
const _dateLeft = toDate(dateLeft);
const _dateRight = toDate(dateRight);
return _dateLeft.getFullYear() === _dateRight.getFullYear();
}
// Fallback for modularized imports:
export default isSameYear;