UNPKG

@ozen-ui/kit

Version:

React component library

15 lines (14 loc) 389 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.monthDiff = void 0; var monthDiff = function (d1, d2) { if (!d1 || !d2) { return 0; } var months; months = (d2.getFullYear() - d1.getFullYear()) * 12; months -= d1.getMonth(); months += d2.getMonth(); return months <= 0 ? 0 : months; }; exports.monthDiff = monthDiff;