Members
(static, constant) DAY :number
Day in milliseconds
Type:
- number
(static, constant) DAYAFTERTOMORROW :number
Day after tomorrow in milliseconds
Type:
- number
(static, constant) HOUR :number
Hour in milliseconds
Type:
- number
(static, constant) MINUTE :number
Minute in milliseconds
Type:
- number
(static, constant) SECOND :number
Second in milliseconds
Type:
- number
(static, constant) TODAY :number
Today in milliseconds
Type:
- number
(static, constant) TOMORROW :number
Tomorrow in milliseconds
Type:
- number
(static, constant) WEEK :number
Week in milliseconds
Type:
- number
(static, constant) YESTERDAY :number
Yesterday in milliseconds
Type:
- number
Methods
addTime(time) → {number}
Parameters:
Name | Type | Description |
---|---|---|
time |
number | Time to add |
Returns:
New timestamp of this Date
- Type
- number
daysPassed(toDateopt) → {number}
- Description:
- Return number of days passed between this Date and given in argument
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
toDate |
Date | string | number |
<optional> |
now
|
Proper date |
Returns:
Number of days passed
- Type
- number
toCustomDate(format) → {string}
Parameters:
Name | Type | Description |
---|---|---|
format |
string | String representing date format |
Returns:
Date string
- Type
- string
toInputDateFormat() → {string}
Returns:
Date string
- Type
- string
toInputTimeFormat() → {string}
Returns:
Time string
- Type
- string
toUiDate() → {string}
- Description:
- Returns this Date in UI date string
- Source:
- See:
-
- Date#getLocalDateFormat
Returns:
Date string
- Type
- string
toUiDateTime(showSecondsopt) → {string}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
showSeconds |
boolean |
<optional> |
true
|
Flag if seconds also should be returned |
Returns:
Time string
- Type
- string
toUiTime(showSecondsopt) → {string}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
showSeconds |
boolean |
<optional> |
true
|
Flag if seconds also should be returned |
Returns:
Time string
- Type
- string
(static) daysFromNow(days) → {number}
Parameters:
Name | Type | Description |
---|---|---|
days |
number | Number of days difference |
Returns:
Timestamp
- Type
- number
(static) getHms(time) → {Object}
Example
// returns { h: 0, m: 1, s: 1, ms: 500 }
Date.getHms(61500)
Parameters:
Name | Type | Description |
---|---|---|
time |
number | Time to be used |
Returns:
Time in stopwatch format
- Type
- Object
(static) getLocalDateFormat(fullFormatopt) → {string}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
fullFormat |
boolean |
<optional> |
true
|
Flag if it should be full date format like dd.mm.yyyy instead d.m.y |
Returns:
Local date format
- Type
- string
(static) getTimezoneName() → {string}
Returns:
Timezone
- Type
- string
(static) parseValue(value) → {Date}
- Description:
- Return new Date instance from given value It's simmilar to native Date.parse, but you can use such strings like: 'today', 'yesterday', 'tomorrow', 'dayaftertomorrow', 'now' Feel free to contribute if you think that this method should support even more!
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string | number | Date | Value to be parsed |
Throws:
Will throw an error if the value is not supported.
Returns:
New Date
- Type
- Date
(static) toHmsFormat(time, accuracyopt) → {string}
Example
// returns '1m 5s'
Date.toHmsFormat(61500)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
time |
number | Time to be converted | ||
accuracy |
string |
<optional> |
seconds
|
Accuracy |
Returns:
Time in HMS format
- Type
- string
(static) toStopwatchFormat(time) → {string}
- Description:
- Returns given time (in milliseconds) in stopwatch format - [HH:]MM:SS.XXX
- Source:
Example
// returns '01:01.5'
Date.toStopwatchFormat(61500)
Parameters:
Name | Type | Description |
---|---|---|
time |
number | Time to be converted |
Returns:
Time in stopwatch format
- Type
- string
(static) toTimerFormat(time) → {string}
- Description:
- Returns given time (in milliseconds) in timer format - [HH:]MM:SS
- Source:
Example
// returns '01:01'
Date.toStopwatchFormat(61500)
Parameters:
Name | Type | Description |
---|---|---|
time |
number | Time to be converted |
Returns:
Time in timer format
- Type
- string