UNPKG

@ozen-ui/kit

Version:

React component library

11 lines (10 loc) 260 B
export 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; };