---
schema_version: "1"
id: 4cda2c9b2bf7bc9b4c76bba4eda95b4a6846a85d85f474e6892fc019b728cfc1
title: isBetween()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/ref-jsapi/ref-jsapi-auralocalizationservice-isbetween.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/ref-jsapi-auralocalizationservice-isbetween.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 764797dca443269868c07749223eef213a8d060bccb3d26cae09c9524ecef77c
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# isBetween()

Checks if `date` is between `fromDate` and `toDate`, where the match is inclusive.

## Signature

`isBetween(string | number | Date date, string | number | Date fromDate, string | number | Date toDate, string unit)`

## Parameters

**_date_:** Type: `string | number | Date`. A datetime string in ISO8601 format, or a timestamp in milliseconds, or a `Date` object.

**_fromDate_:** Type: `string | number | Date`. A datetime string in ISO8601 format, or a timestamp in milliseconds, or a `Date` object.

**_toDate_:** 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', 'second', or 'millisecond'.

## Returns

**Type: `boolean`**

Returns `true` if `date` is between `fromDate` and `toDate`, or `false` otherwise.

## Sample Code

```javascript
// Returns true
$A.localizationService.isBetween("2017-03-07","March 7, 2017", "12/1/2017");
// Returns false
$A.localizationService.isBetween("2017-03-07 12:00", "March 7, 2017 15:00", "12/1/2017");
// Returns true because the unit is "day"
$A.localizationService.isBetween("2017-03-07 12:00", "March 7, 2017 15:00", "12/1/2017", "day");
```

