export const useFormatDuration = (durationInMinutes:number,) => {
    if (!durationInMinutes || durationInMinutes <= 0) return "00:00"

    const hrs = Math.floor(durationInMinutes / 60)
    const mins = Math.floor(durationInMinutes % 60)

    return `${String(hrs).padStart(2, "0")}:${String(mins).padStart(2, "0")}`
}

export const useFormatDurationDays = (start,end) => {
    const startDate = useNuxtApp().$dayjs(start);
    const endDate = useNuxtApp().$dayjs(end);

    if(startDate.isBefore(endDate)){
        // inkl. beider Tage → +1
        const days = endDate.diff(startDate, "day") + 1;

        return days + " Tag" + (days > 1 ? "e" : "");
    } else {
        const days = startDate.diff(endDate, "day") + 1;

        return days + " Tag" + (days > 1 ? "e" : "");
    }

}