Interface: DateAdapter | Chart.js
Description: Open source HTML5 Charts for your website

# # Interface: DateAdapter

## # Properties

### # options

• `Readonly` options: `unknown`

#### # Defined in

adapters.d.ts:8
(opens new window)

## # Methods

### # add

▸ add(`timestamp`, `amount`, `unit`): `number`

Adds the specified `amount` of `unit` to the given `timestamp`.

#### # Parameters

Name | Type | Description
--- | --- | ---
`timestamp` | `number` | the input timestamp
`amount` | `number` | the amount to add
`unit` | `TimeUnit` | the unit as string

#### # Returns

`number`

#### # Defined in

adapters.d.ts:41
(opens new window)

### # diff

▸ diff(`a`, `b`, `unit`): `number`

Returns the number of `unit` between the given timestamps.

#### # Parameters

Name | Type | Description
--- | --- | ---
`a` | `number` | the input timestamp (reference)
`b` | `number` | the timestamp to subtract
`unit` | `TimeUnit` | the unit as string

#### # Returns

`number`

#### # Defined in

adapters.d.ts:49
(opens new window)

### # endOf

▸ endOf(`timestamp`, `unit`): `number`

Returns end of `unit` for the given `timestamp`.

#### # Parameters

Name | Type | Description
--- | --- | ---
`timestamp` | `number` | the input timestamp
`unit` | `TimeUnit` | `"isoWeek"` | the unit as string

#### # Returns

`number`

#### # Defined in

adapters.d.ts:65
(opens new window)

### # format

▸ format(`timestamp`, `format`): `string`

Returns the formatted date in the specified `format` for a given `timestamp`.

#### # Parameters

Name | Type | Description
--- | --- | ---
`timestamp` | `number` | the timestamp to format
`format` | `TimeUnit` | the date/time token

#### # Returns

`string`

#### # Defined in

adapters.d.ts:33
(opens new window)

### # formats

▸ formats(): `Object`

Returns a map of time formats for the supported formatting units defined in Unit as well as 'datetime' representing a detailed date/time string.

#### # Returns

`Object`

#### # Defined in

adapters.d.ts:20
(opens new window)

### # init

▸ init(`chartOptions`): `void`

Will called with chart options after adapter creation.

#### # Parameters

Name | Type
--- | ---
`chartOptions` | `_DeepPartialObject`<`CoreChartOptions`<keyof `ChartTypeRegistry`> & `ElementChartOptions`<keyof `ChartTypeRegistry`> & `PluginChartOptions`<keyof `ChartTypeRegistry`> & `DatasetChartOptions`<keyof `ChartTypeRegistry`> & `ScaleChartOptions`<keyof `ChartTypeRegistry`>>

#### # Returns

`void`

#### # Defined in

adapters.d.ts:14
(opens new window)

### # override

▸ override(`members`): `void`

#### # Parameters

Name | Type
--- | ---
`members` | `Partial`<`DateAdapter`>

#### # Returns

`void`

#### # Defined in

adapters.d.ts:7
(opens new window)

### # parse

▸ parse(`value`, `format?`): `number`

Parses the given `value` and return the associated timestamp.

#### # Parameters

Name | Type | Description
--- | --- | ---
`value` | `unknown` | the value to parse (usually comes from the data)
`format?` | `TimeUnit` | -

#### # Returns

`number`

#### # Defined in

adapters.d.ts:26
(opens new window)

### # startOf

▸ startOf(`timestamp`, `unit`, `weekday?`): `number`

Returns start of `unit` for the given `timestamp`.

#### # Parameters

Name | Type | Description
--- | --- | ---
`timestamp` | `number` | the input timestamp
`unit` | `TimeUnit` | `"isoWeek"` | the unit as string
`weekday?` | `number` | -

#### # Returns

`number`

#### # Defined in

adapters.d.ts:58
(opens new window)