Skip to content

subtractTime ​

The subtractTime() function subtracts a TheTime duration from a TheDate or another TheTime.

Interactive example ​

Syntax ​

Classic signature ​

typescript
function subtractTime<
	GenericInput extends TheDate | SerializedTheDate
>(
	input: GenericInput,
	time: TheTime | SerializedTheTime
): TheDate

function subtractTime<
	GenericInput extends TheTime | SerializedTheTime
>(
	input: GenericInput,
	time: TheTime | SerializedTheTime
): TheTime

Curried signature ​

typescript
function subtractTime<
	GenericInput extends TheDate | SerializedTheDate
>(
	time: TheTime | SerializedTheTime
): (input: GenericInput) => TheDate

function subtractTime<
	GenericInput extends TheTime | SerializedTheTime
>(
	time: TheTime | SerializedTheTime
): (input: GenericInput) => TheTime

Parameters ​

  • time: Duration to subtract as a TheTime.
  • input: TheDate, SerializedTheDate, TheTime, or SerializedTheTime to adjust.

Return value ​

A TheDate or TheTime with the duration removed.

See also ​

Released under the MIT license.