constructFrom
import { constructFrom } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
import { constructFrom } from 'date-fns'
// A function that clones a date preserving the original type
function cloneDate<DateType extends Date(date: DateType): DateType {
return constructFrom(
date, // Use contrustor from the given date
date.getTime() // Use the date value to create a new date
)
}
function constructFrom<DateType extends Date>(date: DateType | number | string, value: Date | number | string): DateType;