Constructor
new TimeUnit(name, intlDateTimeFormat)
Creates a new TimeUnit
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | Name |
intlDateTimeFormat |
Object | Intl.DateTimeFormat format options object |
- Source:
Members
name
Name of a TimeUnit. Aka, his string value representation
- Source:
Methods
convertFromDate(date) → {number}
Convert a date to a Number using the time unit
Parameters:
| Name | Type | Description |
|---|---|---|
date |
Date | Input Date |
- Source:
Returns:
- A number, that using this TimeUnit, represents the same Date
- Type
- number
convertToDate(value) → {Date}
Convert a date to a Number using the time unit
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | Input value in TimeUnits |
- Source:
Returns:
- A equivalent Date to the value in TimeUnits.
- Type
- Date
defaultFormatFunction(locale, formatOptionsopt) → {function}
Returns a functions that formats a value in TimeUnits to a String representation
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
locale |
string | String locale conden | |
formatOptions |
Object |
<optional> |
Intl.DateTimeFormat format options object |
- Source:
Returns:
A format function for the TimeUnit values
- Type
- function
toString() → {string}
- Source:
Returns:
String representation of a TimeUnit for debuing porpuses
- Type
- string
(static) fromName(value) → {TimeUnit}
Gets a TimeUnit from a string value
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string | String name of a TimeUnit |
- Source:
Returns:
A TimeUnit instance or null
- Type
- TimeUnit