startOf()

Returns a date that is the start of a unit of time for the given date.

startOf(string | number | Date date, string unit)

date: Type: string | number | Date. A datetime string in ISO8601 format, or a timestamp in milliseconds, or a Date object.

unit: Type: string. A datetime unit. Options are ‘year’, ‘month’, ‘week’, ‘day’, ‘hour’, ‘minute’, or ‘second’.

Type: Date A JavaScript Date object. If a unit is not provided, returns a parsed date.