The totalDays() method returns the duration converted to days.
DayPilot.Duration.totalDays()Returns the duration converted to days. If the duration includes hours, minutes, seconds, or milliseconds, the result is a fractional number.
const days = new DayPilot.Duration("2020-01-01T00:00:00", "2020-01-05T12:00:00").totalDays(); // 4.5