Date utility methods.
Methods
(static) getWeekDate(dateopt, non-null) → {string}
Gets week date.
- Source:
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
date |
Date
|
<optional> |
The optional date object. |
Returns:
- Type:
-
string
Returns week date in ISO 8601 format.
Example
var weekDate = getWeekDate(new Date(2015, 9, 26));
var expected = '2015-W44';
weekDate === expected;
(static) getWeekNumber(dateopt, non-null) → {number}
Gets week number.
- Source:
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
date |
Date
|
<optional> |
The optional date object. |
Returns:
- Type:
-
number
Returns week number.
(static) toAmPmTime(time) → {string}
Converts 24-hour time string to 12-hour time string.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
time |
string
|
The time string ("00:30", "01:45", "12:00", "22:15"). |
Returns:
- Type:
-
string
Return converted 24-hour time string to 12-hour time.
Example
toAmPmTime('00:30'); // 12:30 AM
toAmPmTime('01:15'); // 1:15 AM
toAmPmTime('11:45'); // 11:45 AM
toAmPmTime('12:15'); // 12:15 PM
toAmPmTime('13:15'); // 1:15 PM
toAmPmTime('23:15'); // 11:15 PM