Skip to content

addTime ​

The addTime() function adds a TheTime duration to a TheDate or another TheTime.

Interactive example ​

Syntax ​

Classic signature ​

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

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

Curried signature ​

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

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

Parameters ​

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

Return value ​

A TheDate or TheTime with the added duration.

See also ​

Released under the MIT license.