-
addTime(time)
→ {number}
-
Add time to this Date
Parameters:
Name |
Type |
Description |
time |
number
|
Time to add |
Returns:
number
- New timestamp of this Date
-
daysPassed(toDateopt)
→ {number}
-
Return number of days passed between this Date and given in argument
Parameters:
Name |
Type |
Attributes |
Default |
Description |
toDate |
Date
|
string
|
number
|
<optional>
|
now
|
Proper date |
Returns:
number
- Number of days passed
-
toCustomDate(format)
→ {string}
-
Returns this Date in custom date format
Parameters:
Name |
Type |
Description |
format |
string
|
String representing date format |
Returns:
string
- Date string
-
-
Returns this Date in forms input date string
Returns:
string
- Date string
-
-
Returns this Date in form inputs time string
Returns:
string
- Time string
-
toUiDate()
→ {string}
-
Returns this Date in UI date string
Returns:
string
- Date string
- See:
-
-
toUiDateTime(showSecondsopt)
→ {string}
-
Returns this Date in UI datetime string
Parameters:
Name |
Type |
Attributes |
Default |
Description |
showSeconds |
boolean
|
<optional>
|
true
|
Flag if seconds also should be returned |
Returns:
string
- Time string
-
toUiTime(showSecondsopt)
→ {string}
-
Returns this Date in UI time string
Parameters:
Name |
Type |
Attributes |
Default |
Description |
showSeconds |
boolean
|
<optional>
|
true
|
Flag if seconds also should be returned |
Returns:
string
- Time string
-
static daysFromNow(days)
→ {number}
-
Return timestamp of now + days
Parameters:
Name |
Type |
Description |
days |
number
|
Number of days difference |
Returns:
number
- Timestamp
-
static getHms(time)
→ {Object}
-
Returns object with time parts
Parameters:
Name |
Type |
Description |
time |
number
|
Time to be used |
Returns:
Object
- Time in stopwatch format
Example
// returns { h: 0, m: 1, s: 1, ms: 500 }
Date.getHms(61500)
-
-
Get local date format
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:
string
- Local date format
-
static getTimezoneName()
→ {string}
-
Get timezone name
Returns:
string
- Timezone
-
static parseValue(value)
→ {Date}
-
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!
Parameters:
Name |
Type |
Description |
value |
*
|
Value to be parsed |
Throws:
Will throw an error if the value is not supported.
-
-
Returns given time (in milliseconds) in HMS format
Parameters:
Name |
Type |
Attributes |
Default |
Description |
time |
number
|
|
|
Time to be converted |
accuracy |
string
|
<optional>
|
seconds
|
Accuracy |
Returns:
string
- Time in HMS format
Example
// returns '1m 5s'
Date.toHmsFormat(61500)
-
-
Returns given time (in milliseconds) in stopwatch format - [HH:]MM:SS.XXX
Parameters:
Name |
Type |
Description |
time |
number
|
Time to be converted |
Returns:
string
- Time in stopwatch format
Example
// returns '01:01.5'
Date.toStopwatchFormat(61500)
-
-
Returns given time (in milliseconds) in timer format - [HH:]MM:SS
Parameters:
Name |
Type |
Description |
time |
number
|
Time to be converted |
Returns:
string
- Time in timer format
Example
// returns '01:01'
Date.toStopwatchFormat(61500)