# compareYear Type documentation

## TypeScript declaration

### [compareYear](<https://github.com/siemens/element/blob/main/projects/element-ng/datepicker/date-time-helper.ts#L594-L595>)

**Kind:** constant

```
import { compareYear } from '@siemens/element-ng/datepicker';
```

Compares two years.

Returns: 0 if the years are equal, a number less than 0 if the first year is earlier, a number greater than 0 if the first year is later.

```
(first: Date, second: Date) => number = ...
```

```
compareYear(first: Date, second: Date): number
```

Compares two years.

Returns: 0 if the years are equal, a number less than 0 if the first year is earlier, a number greater than 0 if the first year is later.

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [first](<https://github.com/siemens/element/blob/main/projects/element-ng/datepicker/date-time-helper.ts#L594-L594>) | `Date` |  | • The first year to compare. |
| [second](<https://github.com/siemens/element/blob/main/projects/element-ng/datepicker/date-time-helper.ts#L594-L594>) | `Date` |  | • The second year to compare. |

**Returns:** [number](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number>)
