Skip to content

round

Rounds a TheDate to the specified unit (unit).

Interactive example

Syntax

typescript
function round(
	input: TheDate,
	unit?: RoundUnit
): TheDate

RoundUnit corresponds to Unit without the millisecond option (day, week, month, year, etc.).

Parameters

  • input: Date to round.
  • unit: Target unit (day by default).

Return value

A TheDate rounded to the requested unit.

See also

Released under the MIT license.