NPV and IRR assume one period between every cash flow. Real deals rarely work like that: a payment in June, another in November, the next the following April.
=XNPV(rate, values, dates) and =XIRR(values, dates, [guess]) take the actual date of each cash flow and discount by the exact number of days, on a 365-day year.
Unlike NPV, XNPV includes the first cash flow at its own date, undiscounted, so there's no "+ year 0" step: give it the whole series. The rate is an annual rate, whatever the spacing of the dates.