---
schema_version: "1"
id: 20a36f951258d27786c0206186e4d2a03f6831a12f56cb72883a1085bee47f27
title: isSame()
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-issame.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/ref-jsapi-auralocalizationservice-issame.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b3e60616fcf3aa04d1e2210dc4cef8c7491a94b15f9204ad6bdf1765a1c4537d
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# isSame()

Checks if `date1` is the same as `date2`.

## Signature

`isSame(string | number | Date date1, string | number | Date date2, string unit)`

## Parameters

**_date1_:** Type: `string | number | Date`. A datetime string in ISO8601 format, or a timestamp in milliseconds, or a `Date` object.

**_date2_:** 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 `date1` is the same as `date2`, or `false` otherwise.

## Sample Code

```javascript
var date = new Date();
var day = $A.localizationService.endOf(date, 'day');
// Returns false
$A.localizationService.isSame(date, day, 'hour');
// Returns true
$A.localizationService.isSame(date, day, 'day');
```

