2.0.3 • Published 4 years ago
dates-formatter-helper v2.0.3
Classes
Typedefs
DatesFormatter
Kind: global class
- DatesFormatter
- new DatesFormatter()
- instance
- .format(date, [asUTC]) ⇒ string
- .formatRange(dateRange, [asUTC]) ⇒ Array.<string>
- .parse(dateString, [asUTC]) ⇒ Date
- .parseRange(dateStringRange, [asUTC]) ⇒ Array.<Date> | Array.<object>
- static
new DatesFormatter()
DatesFormatter Class
datesFormatter.format(date, asUTC) ⇒ string
Formats Date object as string
Kind: instance method of DatesFormatter
Returns: string - String representation of Date
Param | Type | Default | Description |
---|---|---|---|
date | Date | Date object to convert | |
asUTC | boolean | true | Whether to use date input as UTC |
datesFormatter.formatRange(dateRange, asUTC) ⇒ Array.<string>
Formats date range as strings
Kind: instance method of DatesFormatter
Returns: Array.<string> - String representation of Dates
Param | Type | Default | Description |
---|---|---|---|
dateRange | Array.<Date> | Date range to convert | |
asUTC | boolean | true | Whether to use date input as UTC |
datesFormatter.parse(dateString, asUTC) ⇒ Date
Parses date string to Date
Kind: instance method of DatesFormatter
Returns: Date - The parsed date
Param | Type | Default | Description |
---|---|---|---|
dateString | string | Date string to parse | |
asUTC | boolean | true | Whether to use date input as UTC |
datesFormatter.parseRange(dateStringRange, asUTC) ⇒ Array.<Date> | Array.<object>
Parses date string arrays to Date
Kind: instance method of DatesFormatter
Returns: Array.<Date> | Array.<object> - The parsed dates
Param | Type | Default | Description |
---|---|---|---|
dateStringRange | Array.<string> | Date strings array to parse | |
asUTC | boolean | true | Whether to use date input as UTC |
DatesFormatter.DatesFormatter
Kind: static class of DatesFormatter
new DatesFormatter(mode, options)
Creates an instance of DatesFormatter.
Param | Type | Default | Description |
---|---|---|---|
mode | 'year' | 'month' | 'week' | 'date' | Mode to use for formatting | |
options | FormatterOptions | {} | Config to override default formatter strings |
modes
Kind: global enum
Properties
Name | Default |
---|---|
YEAR | year |
MONTH | month |
WEEK | week |
DATE | date |
FormatterOptions
Kind: global typedef
Properties
Name | Type |
---|---|
dateFormat | string |
weekFormat | string |
monthFormat | string |
yearFormat | string |