These are my time formats;
const startTime = "20:00";
const endTime = "05:00";
const startDate = "2021-01-20T00:00:00+05:30"
const days = "1"; // it can be 0 also
Now, I need to find the difference between startTime and endTime using moment, and as the "days = 1", it means the endTime ends on the next day:
So the expected output would be,
9hrs 0mints on 2021-01-21
( As the days says 1, we need to count one day and show the endDate and if days=0 means same date as start date )
How to perform this using moment?
As tried I,
var dif = moment.duration(endTime.diff(startTime))
But it gives the error "endTime.diff is not a function". Please help.