Skip to content

toNative

The toNative() function converts date/time values to their native JavaScript representation.

Interactive example

Syntax

typescript
function toNative<
	GenericInput extends TheDate | SerializedTheDate
>(
	input: GenericInput
): Date

function toNative<
	GenericInput extends TheTime | SerializedTheTime
>(
	input: GenericInput
): number

Parameters

  • input: A value among TheDate, SerializedTheDate, TheTime, or SerializedTheTime.

Return value

  • Date for date inputs.
  • number for time inputs.

See also

Sources

Released under the MIT license.