endOf()
Signature
endOf(string | number | Date date, string unit)
Parameters
- 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'.
Returns
- Type: Date
- A JavaScript Date object. If a unit is not provided, returns a parsed date.
Sample Code
1var date = new Date();
2// Returns the time at the end of the day
3// in the format "Fri Oct 09 2015 23:59:59 GMT-0700 (PDT)"
4var day = $A.localizationService.endOf(date, 'day');