# DateType | tablefilter v0.5.3 API Document

    import {DateType} from 'tablefilter/src/modules/dateType.js'

public class | source

# DateType

#### Extends:

Feature → DateType

Wrapper for Sugar Date module providing datetime helpers and locales

## Constructor Summary

Public Constructor
public | constructor (tf: TableFilter) Creates an instance of DateType |

## Member Summary

Public Members
public | datetime : Object Sugar Date instance |
public | initialized : boolean |
public | locale : String Global locale |

## Method Summary

Public Methods
public | addConfigFormats (types: Array) Add date time format(s) to a locale as specified by the passed collection of column types, ie: [ 'string', 'number', { type: 'date', locale: 'en', format: ['{dd}/{MM}/{yyyy}']} ] |
public | destroy () Remove DateType instance |
public | getOptions (colIndex: Number, types: Array): Object Return the type object of a specified column as per configuration or passed collection |
public | init () Initialize DateType instance |
public | isValid (dateStr: any, localeCode: any): Boolean Check string representation of a date for a specified locale is valid |
public | parse (dateStr: String, localeCode: String): Date Parse a string representation of a date for a specified locale and return a date object |

## Inherited Summary

From class Feature
public | config : Object TableFilter configuration |
public | emitter : Emitter TableFilter emitter instance |
public | enabled : Boolean TableFilter feature setting |
public | feature : String Feature name |
public | initialized : Boolean Field indicating whether Feature is initialized |
public | tf : TableFilter TableFilter instance |
public | destroy () Destroy the feature |
public | disable () Disable the feature |
public | enable () Enable the feature |
public | init () Initialize the feature |
public | isEnabled (): Boolean Indicate whether the feature is enabled or not |
public | reset () Reset the feature after being disabled |

## Public Constructors

### public constructor(tf: TableFilter) source

Creates an instance of DateType

#### Override:

Feature#constructor

#### Params:

Name | Type | Attribute | Description
tf | TableFilter |  | TableFilter instance

## Public Members

### public datetime: Object source

Sugar Date instance

### public initialized: boolean source

#### Override:

Feature#initialized

### public locale: String source

Global locale

## Public Methods

### public addConfigFormats(types: Array) source

Add date time format(s) to a locale as specified by the passed collection of column types, ie: [ 'string', 'number', { type: 'date', locale: 'en', format: ['{dd}/{MM}/{yyyy}']} ]

#### Params:

Name | Type | Attribute | Description

types

Array

- optional
- default: []

Collection of column types

### public destroy() source

Remove DateType instance

#### Override:

Feature#destroy

### public getOptions(colIndex: Number, types: Array): Object source

Return the type object of a specified column as per configuration or passed collection

#### Params:

Name | Type | Attribute | Description
colIndex | Number |  | Column index
types | Array |  | Collection of column types, optional

#### Return:

Object

### public init() source

Initialize DateType instance

#### Override:

Feature#init

### public isValid(dateStr: any, localeCode: any): Boolean source

Check string representation of a date for a specified locale is valid

#### Params:

Name | Type | Attribute | Description
dateStr | any |  | String representation of a date
localeCode | any |  | Locale code (ie 'en-us')

#### Return:

Boolean

### public parse(dateStr: String, localeCode: String): Date source

Parse a string representation of a date for a specified locale and return a date object

#### Params:

Name | Type | Attribute | Description
dateStr | String |  | String representation of a date
localeCode | String |  | Locale code (ie 'en-us')

#### Return:

Date