transpose
import { transpose } from "https://esm.sh/v135/date-fns@3.6.0/index.d.mts";
@example
// Create July 10, 2022 00:00 in locale time zone
const date = new Date(2022, 6, 10)
//=> 'Sun Jul 10 2022 00:00:00 GMT+0800 (Singapore Standard Time)'
@example
// Transpose the date to July 10, 2022 00:00 in UTC
transpose(date, UTCDate)
//=> 'Sun Jul 10 2022 00:00:00 GMT+0000 (Coordinated Universal Time)'
function transpose<DateInputType extends Date, DateOutputType extends Date>(fromDate: DateInputType, constructor: DateOutputType | GenericDateConstructor<DateOutputType>): DateOutputType;
§
transpose<DateInputType extends Date, DateOutputType extends Date>(fromDate: DateInputType, constructor: DateOutputType | GenericDateConstructor<DateOutputType>): DateOutputType
[src]§Parameters
§
constructor: DateOutputType | GenericDateConstructor<DateOutputType>
[src]- The date constructor to use