Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
startOf()
Signature
startOf(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 = "2015-10-9";
2// Returns "Thu Oct 01 2015 00:00:00 GMT-0700 (PDT)"
3$A.localizationService.startOf(date, 'month');