/*!
 * Built by ShiftSoftware
 * Copyright (c)
 */
import { d as dateFnsExports } from './loader-icon-DM4Vm5gX.js';

function decodeTimeOffset({ offsets, type, date = dateFnsExports.startOfDay(new Date()) }) {
    if (offsets.length > 0)
        date = dateFnsExports.addYears(date, offsets[0]);
    if (offsets.length > 1)
        date = dateFnsExports.addMonths(date, offsets[1]);
    if (offsets.length > 2)
        date = dateFnsExports.addDays(date, offsets[2]);
    if (offsets.length > 3)
        date = dateFnsExports.addHours(date, offsets[3]);
    if (offsets.length > 4)
        date = dateFnsExports.addMinutes(date, offsets[4]);
    if (offsets.length > 5)
        date = dateFnsExports.addSeconds(date, offsets[5]);
    if (type) {
        switch (type) {
            case 'date':
                return dateFnsExports.format(date, 'yyyy-MM-dd');
            case 'time':
                return dateFnsExports.format(date, 'HH:mm');
            case 'datetime-local':
                return dateFnsExports.format(date, "yyyy-MM-dd'T'HH:mm");
            default:
                return date;
        }
    }
    return date;
}

export { decodeTimeOffset as d };
