
export const ordinalToDate = (ordinal: number | string): Date => {
    const year = parseInt(`20${ordinal.toString().substring(0, 2)}`);
    const day = parseInt(ordinal.toString().substring(2));
    const date = new Date(year, 0);
    date.setDate(day);
    return date;
};

export const dateToOrdinal = (date: Date): number => {
    const start = new Date(date.getUTCFullYear(), 0, 0);
    const diff = date.getTime() - start.getTime();
    const day = `00${(Math.floor(diff / (1000 * 60 * 60 * 24)) + 1)}`;
    return parseInt(`${(`${date.getUTCFullYear()}`).substring(2)}${day.substring(day.length - 3)}`);
};
