New JavaScript API Methods

Use JavaScript API methods in your component’s client-side controller, helper, or renderer.

The following methods are new.

AuraLocalizationService.isBetween(date, fromDate, toDate, unit)
Checks if a date is between two other dates (fromDate and toDate), where the match is inclusive. Only date formats that the JavaScript Date object can parse are supported. The unit denotes the unit of time to limit granularity, such as second, minute, hour, day, week, month, and year. The default is millisecond. Here are a few examples.
  • $A.localizationService.isBetween("2017-03-07", "March 7, 2017", "12/1/2017") returns true.
  • $A.localizationService.isBetween("2017-03-07 12:00", "March 7, 2017 15:00", "12/1/2017") returns false.
  • $A.localizationService.isBetween("2017-03-07 12:00", "March 7, 2017 15:00", "12/1/2017", "day") returns true.
Dynamically adds a handler for a component event or application event. Use this method instead of the deprecated addHandler() method.