-
Notifications
You must be signed in to change notification settings - Fork 0
dateplus
@luke-zhang-04/dateplus / Exports / DatePlus
Dateplus - A class and namespace program to assist with date manipulation
-
Date
↳ DatePlus
- [Symbol.toPrimitive]
- addZeros
- formatDate
- getDate
- getDay
- getElapsedDays
- getElapsedHours
- getElapsedMinutes
- getElapsedMs
- getElapsedSeconds
- getElapsedString
- getFullYear
- getHours
- getMilliseconds
- getMinutes
- getMonth
- getSeconds
- getTime
- getTimezoneOffset
- getUTCDate
- getUTCDay
- getUTCFullYear
- getUTCHours
- getUTCMilliseconds
- getUTCMinutes
- getUTCMonth
- getUTCSeconds
- getWordDay
- getWordMonth
- setDate
- setFullYear
- setHours
- setMilliseconds
- setMinutes
- setMonth
- setSeconds
- setTime
- setUTCDate
- setUTCFullYear
- setUTCHours
- setUTCMilliseconds
- setUTCMinutes
- setUTCMonth
- setUTCSeconds
- toDateString
- toISOString
- toJSON
- toLocaleDateString
- toLocaleString
- toLocaleTimeString
- toString
- toTimeString
- toUTCString
- valueOf
- UTC
- now
- parse
• new DatePlus()
Date.constructor
node_modules/typescript/lib/lib.es5.d.ts:882
• new DatePlus(value
)
Name | Type |
---|---|
value |
string | number
|
Date.constructor
node_modules/typescript/lib/lib.es5.d.ts:883
• new DatePlus(year
, month
, date?
, hours?
, minutes?
, seconds?
, ms?
)
Name | Type |
---|---|
year |
number |
month |
number |
date? |
number |
hours? |
number |
minutes? |
number |
seconds? |
number |
ms? |
number |
Date.constructor
node_modules/typescript/lib/lib.es5.d.ts:884
• new DatePlus(vd
)
Name | Type |
---|---|
vd |
VarDate |
Date.constructor
node_modules/typescript/lib/lib.scripthost.d.ts:321
• new DatePlus(value
)
Name | Type |
---|---|
value |
string | number | Date
|
Date.constructor
node_modules/typescript/lib/lib.es2015.core.d.ts:89
• getVarDate: () => VarDate
▸ (): VarDate
VarDate
Date.getVarDate
node_modules/typescript/lib/lib.scripthost.d.ts:326
▸ [Symbol.toPrimitive](hint
): string
Converts a Date object to a string.
Name | Type |
---|---|
hint |
"default" |
string
Date.__@toPrimitive
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:114
▸ [Symbol.toPrimitive](hint
): string
Converts a Date object to a string.
Name | Type |
---|---|
hint |
"string" |
string
Date.__@toPrimitive
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:118
▸ [Symbol.toPrimitive](hint
): number
Converts a Date object to a number.
Name | Type |
---|---|
hint |
"number" |
number
Date.__@toPrimitive
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:122
▸ [Symbol.toPrimitive](hint
): string
| number
Converts a Date object to a string or number.
throws
{TypeError} If 'hint' was given something other than "number", "string", or "default".
Name | Type | Description |
---|---|---|
hint |
string |
The strings "number", "string", or "default" to specify what primitive to return. |
string
| number
A number if 'hint' was "number", a string if 'hint' was "string" or "default".
Date.__@toPrimitive
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:131
▸ addZeros(seperator?
): string
Add's 0s to date (e.g 2020/4/3 => 2020/04/03)
Name | Type | Default value | Description |
---|---|---|---|
seperator |
string |
"/" | Char the date is seperatred by |
string
- Date with zeros
▸ formatDate(format?
, seperator?
): string
Format instantiated into a string in the form YYYY{seperator}MM{seperator}DD
Name | Type | Default value | Description |
---|---|---|---|
format |
DateFormat | "y:m:d" | Format of string date |
seperator |
string |
"/" | Char to seperate date with |
string
Formatted date
▸ getDate(): number
Gets the day-of-the-month, using local time.
number
Date.getDate
node_modules/typescript/lib/lib.es5.d.ts:755
▸ getDay(): number
Gets the day of the week, using local time.
number
Date.getDay
node_modules/typescript/lib/lib.es5.d.ts:759
▸ getElapsedDays(date
): number
Calculates number of elapsed days between instantiated date and dae
Name | Type | Description |
---|---|---|
date |
Date |
Ending date object to calculate |
number
- Number of elapsed days
▸ getElapsedHours(date
): number
Calculates number of elapsed hours between date1 and date2
Name | Type | Description |
---|---|---|
date |
Date |
Ending date object to calculate |
number
- Number of elapsed hours
▸ getElapsedMinutes(date
): number
Calculates number of elapsed minutes between date1 and date2
Name | Type | Description |
---|---|---|
date |
Date |
Ending date object to calculate |
number
- Number of elapsed minutes
▸ getElapsedMs(date
): number
Calculates number of elapsed milliseconds between date1 and date2
Name | Type | Description |
---|---|---|
date |
Date |
Ending date object to calculate |
number
- Number of elapsed milliseconds
▸ getElapsedSeconds(date
): number
Calculates number of elapsed seconds between date1 and date2
Name | Type | Description |
---|---|---|
date |
Date |
Ending date object to calculate |
number
- Number of elapsed seconds
▸ getElapsedString(date
, approx?
): string
Calculates elapsed time between current and previous
Name | Type | Default value | Description |
---|---|---|---|
date |
Date |
undefined |
End date |
approx |
string |
"about" | Text to append to values from days and on, e.g about 1 day aga |
string
Time difference in string form, e.g "3 seconds ago"
▸ getFullYear(): number
Gets the year, using local time.
number
Date.getFullYear
node_modules/typescript/lib/lib.es5.d.ts:747
▸ getHours(): number
Gets the hours in a date, using local time.
number
Date.getHours
node_modules/typescript/lib/lib.es5.d.ts:763
▸ getMilliseconds(): number
Gets the milliseconds of a Date, using local time.
number
Date.getMilliseconds
node_modules/typescript/lib/lib.es5.d.ts:775
▸ getMinutes(): number
Gets the minutes of a Date object, using local time.
number
Date.getMinutes
node_modules/typescript/lib/lib.es5.d.ts:767
▸ getMonth(): number
Gets the month, using local time.
number
Date.getMonth
node_modules/typescript/lib/lib.es5.d.ts:751
▸ getSeconds(): number
Gets the seconds of a Date object, using local time.
number
Date.getSeconds
node_modules/typescript/lib/lib.es5.d.ts:771
▸ getTime(): number
Gets the time value in milliseconds.
number
Date.getTime
node_modules/typescript/lib/lib.es5.d.ts:745
▸ getTimezoneOffset(): number
Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC).
number
Date.getTimezoneOffset
node_modules/typescript/lib/lib.es5.d.ts:779
▸ getUTCDate(): number
Gets the day-of-the-month, using Universal Coordinated Time (UTC).
number
Date.getUTCDate
node_modules/typescript/lib/lib.es5.d.ts:757
▸ getUTCDay(): number
Gets the day of the week using Universal Coordinated Time (UTC).
number
Date.getUTCDay
node_modules/typescript/lib/lib.es5.d.ts:761
▸ getUTCFullYear(): number
Gets the year using Universal Coordinated Time (UTC).
number
Date.getUTCFullYear
node_modules/typescript/lib/lib.es5.d.ts:749
▸ getUTCHours(): number
Gets the hours value in a Date object using Universal Coordinated Time (UTC).
number
Date.getUTCHours
node_modules/typescript/lib/lib.es5.d.ts:765
▸ getUTCMilliseconds(): number
Gets the milliseconds of a Date object using Universal Coordinated Time (UTC).
number
Date.getUTCMilliseconds
node_modules/typescript/lib/lib.es5.d.ts:777
▸ getUTCMinutes(): number
Gets the minutes of a Date object using Universal Coordinated Time (UTC).
number
Date.getUTCMinutes
node_modules/typescript/lib/lib.es5.d.ts:769
▸ getUTCMonth(): number
Gets the month of a Date object using Universal Coordinated Time (UTC).
number
Date.getUTCMonth
node_modules/typescript/lib/lib.es5.d.ts:753
▸ getUTCSeconds(): number
Gets the seconds of a Date object using Universal Coordinated Time (UTC).
number
Date.getUTCSeconds
node_modules/typescript/lib/lib.es5.d.ts:773
▸ getWordDay(): string
Gets instantiated day of week in word form (e.g 0 => "Sunday")
string
Stringed day of week
▸ getWordMonth(): string
Gets instantiated month in word form (e.g 0 => "January")
string
Stringed worded month
▸ setDate(date
): number
Sets the numeric day-of-the-month value of the Date object using local time.
Name | Type | Description |
---|---|---|
date |
number |
A numeric value equal to the day of the month. |
number
Date.setDate
node_modules/typescript/lib/lib.es5.d.ts:842
▸ setFullYear(year
, month?
, date?
): number
Sets the year of the Date object using local time.
Name | Type | Description |
---|---|---|
year |
number |
A numeric value for the year. |
month? |
number |
A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. |
date? |
number |
A numeric value equal for the day of the month. |
number
Date.setFullYear
node_modules/typescript/lib/lib.es5.d.ts:866
▸ setHours(hours
, min?
, sec?
, ms?
): number
Sets the hour value in the Date object using local time.
Name | Type | Description |
---|---|---|
hours |
number |
A numeric value equal to the hours value. |
min? |
number |
A numeric value equal to the minutes value. |
sec? |
number |
A numeric value equal to the seconds value. |
ms? |
number |
A numeric value equal to the milliseconds value. |
number
Date.setHours
node_modules/typescript/lib/lib.es5.d.ts:829
▸ setMilliseconds(ms
): number
Sets the milliseconds value in the Date object using local time.
Name | Type | Description |
---|---|---|
ms |
number |
A numeric value equal to the millisecond value. |
number
Date.setMilliseconds
node_modules/typescript/lib/lib.es5.d.ts:789
▸ setMinutes(min
, sec?
, ms?
): number
Sets the minutes value in the Date object using local time.
Name | Type | Description |
---|---|---|
min |
number |
A numeric value equal to the minutes value. |
sec? |
number |
A numeric value equal to the seconds value. |
ms? |
number |
A numeric value equal to the milliseconds value. |
number
Date.setMinutes
node_modules/typescript/lib/lib.es5.d.ts:814
▸ setMonth(month
, date?
): number
Sets the month value in the Date object using local time.
Name | Type | Description |
---|---|---|
month |
number |
A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. |
date? |
number |
A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. |
number
Date.setMonth
node_modules/typescript/lib/lib.es5.d.ts:853
▸ setSeconds(sec
, ms?
): number
Sets the seconds value in the Date object using local time.
Name | Type | Description |
---|---|---|
sec |
number |
A numeric value equal to the seconds value. |
ms? |
number |
A numeric value equal to the milliseconds value. |
number
Date.setSeconds
node_modules/typescript/lib/lib.es5.d.ts:801
▸ setTime(time
): number
Sets the date and time value in the Date object.
Name | Type | Description |
---|---|---|
time |
number |
A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. |
number
Date.setTime
node_modules/typescript/lib/lib.es5.d.ts:784
▸ setUTCDate(date
): number
Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).
Name | Type | Description |
---|---|---|
date |
number |
A numeric value equal to the day of the month. |
number
Date.setUTCDate
node_modules/typescript/lib/lib.es5.d.ts:847
▸ setUTCFullYear(year
, month?
, date?
): number
Sets the year value in the Date object using Universal Coordinated Time (UTC).
Name | Type | Description |
---|---|---|
year |
number |
A numeric value equal to the year. |
month? |
number |
A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. |
date? |
number |
A numeric value equal to the day of the month. |
number
Date.setUTCFullYear
node_modules/typescript/lib/lib.es5.d.ts:873
▸ setUTCHours(hours
, min?
, sec?
, ms?
): number
Sets the hours value in the Date object using Universal Coordinated Time (UTC).
Name | Type | Description |
---|---|---|
hours |
number |
A numeric value equal to the hours value. |
min? |
number |
A numeric value equal to the minutes value. |
sec? |
number |
A numeric value equal to the seconds value. |
ms? |
number |
A numeric value equal to the milliseconds value. |
number
Date.setUTCHours
node_modules/typescript/lib/lib.es5.d.ts:837
▸ setUTCMilliseconds(ms
): number
Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).
Name | Type | Description |
---|---|---|
ms |
number |
A numeric value equal to the millisecond value. |
number
Date.setUTCMilliseconds
node_modules/typescript/lib/lib.es5.d.ts:794
▸ setUTCMinutes(min
, sec?
, ms?
): number
Sets the minutes value in the Date object using Universal Coordinated Time (UTC).
Name | Type | Description |
---|---|---|
min |
number |
A numeric value equal to the minutes value. |
sec? |
number |
A numeric value equal to the seconds value. |
ms? |
number |
A numeric value equal to the milliseconds value. |
number
Date.setUTCMinutes
node_modules/typescript/lib/lib.es5.d.ts:821
▸ setUTCMonth(month
, date?
): number
Sets the month value in the Date object using Universal Coordinated Time (UTC).
Name | Type | Description |
---|---|---|
month |
number |
A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. |
date? |
number |
A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. |
number
Date.setUTCMonth
node_modules/typescript/lib/lib.es5.d.ts:859
▸ setUTCSeconds(sec
, ms?
): number
Sets the seconds value in the Date object using Universal Coordinated Time (UTC).
Name | Type | Description |
---|---|---|
sec |
number |
A numeric value equal to the seconds value. |
ms? |
number |
A numeric value equal to the milliseconds value. |
number
Date.setUTCSeconds
node_modules/typescript/lib/lib.es5.d.ts:807
▸ toDateString(): string
Returns a date as a string value.
string
Date.toDateString
node_modules/typescript/lib/lib.es5.d.ts:733
▸ toISOString(): string
Returns a date as a string value in ISO format.
string
Date.toISOString
node_modules/typescript/lib/lib.es5.d.ts:877
▸ toJSON(key?
): string
Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization.
Name | Type |
---|---|
key? |
any |
string
Date.toJSON
node_modules/typescript/lib/lib.es5.d.ts:879
▸ toLocaleDateString(): string
Returns a date as a string value appropriate to the host environment's current locale.
string
Date.toLocaleDateString
node_modules/typescript/lib/lib.es5.d.ts:739
▸ toLocaleDateString(locales?
, options?
): string
Converts a date to a string by using the current or specified locale.
Name | Type | Description |
---|---|---|
locales? |
string | string [] |
A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. |
options? |
DateTimeFormatOptions |
An object that contains one or more properties that specify comparison options. |
string
Date.toLocaleDateString
node_modules/typescript/lib/lib.es5.d.ts:4427
▸ toLocaleString(): string
Returns a value as a string value appropriate to the host environment's current locale.
string
Date.toLocaleString
node_modules/typescript/lib/lib.es5.d.ts:737
▸ toLocaleString(locales?
, options?
): string
Converts a date and time to a string by using the current or specified locale.
Name | Type | Description |
---|---|---|
locales? |
string | string [] |
A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. |
options? |
DateTimeFormatOptions |
An object that contains one or more properties that specify comparison options. |
string
Date.toLocaleString
node_modules/typescript/lib/lib.es5.d.ts:4421
▸ toLocaleTimeString(): string
Returns a time as a string value appropriate to the host environment's current locale.
string
Date.toLocaleTimeString
node_modules/typescript/lib/lib.es5.d.ts:741
▸ toLocaleTimeString(locales?
, options?
): string
Converts a time to a string by using the current or specified locale.
Name | Type | Description |
---|---|---|
locales? |
string | string [] |
A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. |
options? |
DateTimeFormatOptions |
An object that contains one or more properties that specify comparison options. |
string
Date.toLocaleTimeString
node_modules/typescript/lib/lib.es5.d.ts:4434
▸ toString(): string
Returns a string representation of a date. The format of the string depends on the locale.
string
Date.toString
node_modules/typescript/lib/lib.es5.d.ts:731
▸ toTimeString(): string
Returns a time as a string value.
string
Date.toTimeString
node_modules/typescript/lib/lib.es5.d.ts:735
▸ toUTCString(): string
Returns a date converted to a string using Universal Coordinated Time (UTC).
string
Date.toUTCString
node_modules/typescript/lib/lib.es5.d.ts:875
▸ valueOf(): number
Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC.
number
Date.valueOf
node_modules/typescript/lib/lib.es5.d.ts:743
▸ Static
UTC(year
, month
, date?
, hours?
, minutes?
, seconds?
, ms?
): number
Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
Name | Type | Description |
---|---|---|
year |
number |
The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. |
month |
number |
The month as a number between 0 and 11 (January to December). |
date? |
number |
The date as a number between 1 and 31. |
hours? |
number |
Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. |
minutes? |
number |
Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. |
seconds? |
number |
Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. |
ms? |
number |
A number from 0 to 999 that specifies the milliseconds. |
number
Date.UTC
node_modules/typescript/lib/lib.es5.d.ts:903
▸ Static
now(): number
number
Date.now
node_modules/typescript/lib/lib.es5.d.ts:904
▸ Static
parse(s
): number
Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.
Name | Type | Description |
---|---|---|
s |
string |
A date string |
number
Date.parse
node_modules/typescript/lib/lib.es5.d.ts:892
@luke-zhang-04/dateplus / Exports
- addZeros
- daysToHours
- daysToHrs
- daysToMins
- daysToMinutes
- daysToMs
- daysToSeconds
- daysToSecs
- formatDate
- getDateValues
- getElapsedDays
- getElapsedHours
- getElapsedMinutes
- getElapsedMs
- getElapsedSeconds
- getElapsedString
- getUtcTime
- getWordDay
- getWordMonth
- hoursToDays
- hoursToMinutes
- hoursToMs
- hoursToSeconds
- hrsToDays
- hrsToMins
- hrsToMs
- hrsToSecs
- minsToDays
- minsToHrs
- minsToMs
- minsToSecs
- minutesToDays
- minutesToHours
- minutesToMs
- minutesToSeconds
- msToDays
- msToHours
- msToHrs
- msToMins
- msToMinutes
- msToSeconds
- msToSecs
- secondsToDays
- secondsToHours
- secondsToMinutes
- secondsToMs
- secsToDays
- secsToHrs
- secsToMins
- secsToMs
- utcToLocal
Renames and exports: DatePlus
Ƭ DateFormat: "y:m:d"
| "y:d:m"
| "m:d:y"
| "m:y:d"
| "d:m:y"
| "d:y:m"
• Const
daysReference: Object
Reference to days of the week, zero indexed
Name | Type |
---|---|
0 |
string |
1 |
string |
2 |
string |
3 |
string |
4 |
string |
5 |
string |
6 |
string |
• Const
monthsReference: Object
Reference to months of a year, zero indexed
Name | Type |
---|---|
0 |
string |
1 |
string |
10 |
string |
11 |
string |
2 |
string |
3 |
string |
4 |
string |
5 |
string |
6 |
string |
7 |
string |
8 |
string |
9 |
string |
• Const
oneDay: number
One day in ms
• Const
oneHour: number
One hour in ms
• Const
oneMinute: number
One minutes in ms
• Const
values: Object
Name | Type |
---|---|
hrsPerDay |
number |
minsPerHr |
number |
msPerSec |
number |
secsPerMin |
number |
▸ Const
addZeros(date
, seperator?
): string
Add's 0s to date (e.g 2020/4/3 => 2020/04/03)
Name | Type | Default value | Description |
---|---|---|---|
date |
string |
undefined |
String date to format |
seperator |
string |
"/" | Char the date is seperatred by |
string
- Date with zeros
▸ Const
daysToHours(days
): number
Name | Type |
---|---|
days |
number |
number
▸ Const
daysToHrs(days
): number
Converts days to hours
Name | Type | Description |
---|---|---|
days |
number |
Days to convert |
number
Converted hours
▸ Const
daysToMins(days
): number
Converts days to minutes
Name | Type | Description |
---|---|---|
days |
number |
Days to convert |
number
Converted minutes
▸ Const
daysToMinutes(days
): number
Name | Type |
---|---|
days |
number |
number
▸ Const
daysToMs(days
): number
Converts days to milliseconds
Name | Type | Description |
---|---|---|
days |
number |
Days to convert |
number
Converted milliseconds
▸ Const
daysToSeconds(days
): number
Name | Type |
---|---|
days |
number |
number
▸ Const
daysToSecs(days
): number
Converts days to seconds
Name | Type | Description |
---|---|---|
days |
number |
Days to convert |
number
Converted seconds
▸ Const
formatDate(date
, format?
, seperator?
): string
Format date into a string in the form YYYY{seperator}MM{seperator}DD
Name | Type | Default value | Description |
---|---|---|---|
date |
Date |
undefined |
Date object to format |
format |
DateFormat | "y:m:d" | Format of string date |
seperator |
string |
"/" | String to seperate date values with |
string
Formatted date
▸ Const
getDateValues(date
, format?
, seperator?
): YearObj
Gets date values and outputs an object
Name | Type | Default value | Description |
---|---|---|---|
date |
string |
undefined |
Date to extract values from, months zero indexed |
format |
DateFormat | "y:m:d" | Format of string date |
seperator |
string |
"auto" | Seperator the date works with; leave auto for auto detection, limited to 1 char |
Object with all values
▸ Const
getElapsedDays(date1
, date2
): number
Calculates number of elapsed days between date1 and date2
Name | Type | Description |
---|---|---|
date1 |
Date |
Starting date object to calculate |
date2 |
Date |
Ending date object to calculate |
number
- Number of elapsed days
▸ Const
getElapsedHours(date1
, date2
): number
Calculates number of elapsed hours between date1 and date2
Name | Type | Description |
---|---|---|
date1 |
Date |
Starting date object to calculate |
date2 |
Date |
Ending date object to calculate |
number
- Number of elapsed hours
▸ Const
getElapsedMinutes(date1
, date2
): number
Calculates number of elapsed minutes between date1 and date2
Name | Type | Description |
---|---|---|
date1 |
Date |
Starting date object to calculate |
date2 |
Date |
Ending date object to calculate |
number
- Number of elapsed minutes
▸ Const
getElapsedMs(date1
, date2
): number
Calculates number of elapsed milliseconds between date1 and date2
Name | Type | Description |
---|---|---|
date1 |
Date |
Starting date object to calculate |
date2 |
Date |
Ending date object to calculate |
number
- Number of elapsed milliseconds
▸ Const
getElapsedSeconds(date1
, date2
): number
Calculates number of elapsed seconds between date1 and date2
Name | Type | Description |
---|---|---|
date1 |
Date |
Starting date object to calculate |
date2 |
Date |
Ending date object to calculate |
number
- Number of elapsed seconds
▸ Const
getElapsedString(start
, end
, approx?
): string
Calculates elapsed time between current and previous
Name | Type | Default value | Description |
---|---|---|---|
start |
Date |
undefined |
- |
end |
Date |
undefined |
End date |
approx |
string |
"about" | Text to append to values from days and on, e.g about 1 day aga |
string
Time difference in string form, e.g "3 seconds ago"
▸ Const
getUtcTime(): number
Get the current UTC Time
number
UTC Time
▸ Const
getWordDay(numerical
): string
Converts numerical day of week into word form (e.g 0 => "Sunday")
Name | Type | Description |
---|---|---|
numerical |
0 | 1 | 2 | 3 | 4 | 5 | 6
|
Numerical day of week, 0 indexed (0-6) |
string
Stringed day of week
▸ Const
getWordMonth(numerical
): string
Converts numerical month into word form (e.g 0 => "January")
Name | Type | Description |
---|---|---|
numerical |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11
|
Numerical day of week, 0 indexed (0-11) |
string
Stringed worded month
▸ Const
hoursToDays(hrs
): DaysObj
Name | Type |
---|---|
hrs |
number |
▸ Const
hoursToMinutes(hours
): number
Name | Type |
---|---|
hours |
number |
number
▸ Const
hoursToMs(hours
): number
Name | Type |
---|---|
hours |
number |
number
▸ Const
hoursToSeconds(hours
): number
Name | Type |
---|---|
hours |
number |
number
▸ Const
hrsToDays(hrs
): DaysObj
Converts hours to days with remainders
Name | Type | Description |
---|---|---|
hrs |
number |
Hours to convert |
Converted days
▸ Const
hrsToMins(hours
): number
Converts hours to minutes
Name | Type | Description |
---|---|---|
hours |
number |
Hours to convert |
number
Converted minutes
▸ Const
hrsToMs(hours
): number
Converts hours to milliseconds
Name | Type | Description |
---|---|---|
hours |
number |
Hours to convert |
number
Converted milliseconds
▸ Const
hrsToSecs(hours
): number
Converts hours to seconds
Name | Type | Description |
---|---|---|
hours |
number |
Hours to convert |
number
Converted seconds
▸ Const
minsToDays(mins
): DaysObj
Converts minutes to days with remainders
Name | Type | Description |
---|---|---|
mins |
number |
Minutes to convert |
Converted days
▸ Const
minsToHrs(mins
): HoursObj
Converts minutes to hours with remainders
Name | Type | Description |
---|---|---|
mins |
number |
Minutes to convert |
Converted hours
▸ Const
minsToMs(mins
): number
Converts hours to milliseconds
Name | Type | Description |
---|---|---|
mins |
number |
Minutes to convert |
number
Converted milliseconds
▸ Const
minsToSecs(mins
): number
Converts hours to seconds
Name | Type | Description |
---|---|---|
mins |
number |
Minutes to convert |
number
Converted seconds
▸ Const
minutesToDays(mins
): DaysObj
Name | Type |
---|---|
mins |
number |
▸ Const
minutesToHours(mins
): HoursObj
Name | Type |
---|---|
mins |
number |
▸ Const
minutesToMs(secs
): DaysObj
Name | Type |
---|---|
secs |
number |
▸ Const
minutesToSeconds(mins
): number
Name | Type |
---|---|
mins |
number |
number
▸ Const
msToDays(ms
): DaysObj
Converts milliseconds to days with remainders
Name | Type | Description |
---|---|---|
ms |
number |
Milliseconds to convert |
Object with days, hours, minutes, seconds, and milliseconds
▸ Const
msToHours(ms
): HoursObj
Name | Type |
---|---|
ms |
number |
▸ Const
msToHrs(ms
): HoursObj
Converts milliseconds to hours with remainders
Name | Type | Description |
---|---|---|
ms |
number |
Milliseconds to convert |
Object with hours, minutes, seconds, and milliseconds
▸ Const
msToMins(ms
): MinutesObj
Converts milliseconds to minutes with remainders
Name | Type | Description |
---|---|---|
ms |
number |
Milliseconds to convert |
Object with minutes, seconds, and milliseconds
▸ Const
msToMinutes(ms
): MinutesObj
Name | Type |
---|---|
ms |
number |
▸ Const
msToSeconds(ms
): SecondsObj
Name | Type |
---|---|
ms |
number |
▸ Const
msToSecs(ms
): SecondsObj
Converts milliseconds to seconds with remainders
Name | Type | Description |
---|---|---|
ms |
number |
Milliseconds to convert |
Object with seconds and milliseconds
▸ Const
secondsToDays(secs
): DaysObj
Name | Type |
---|---|
secs |
number |
▸ Const
secondsToHours(secs
): HoursObj
Name | Type |
---|---|
secs |
number |
▸ Const
secondsToMinutes(secs
): MinutesObj
Name | Type |
---|---|
secs |
number |
▸ Const
secondsToMs(secs
): number
Name | Type |
---|---|
secs |
number |
number
▸ Const
secsToDays(secs
): DaysObj
Converts seconds to days with remainders
Name | Type | Description |
---|---|---|
secs |
number |
Seconds to convert |
Converted days
▸ Const
secsToHrs(secs
): HoursObj
Converts seconds to hours with remainders
Name | Type | Description |
---|---|---|
secs |
number |
Seconds to convert |
Converted hours
▸ Const
secsToMins(secs
): MinutesObj
Converts seconds to minutes with remainders
Name | Type | Description |
---|---|---|
secs |
number |
Seconds to convert |
Converted minutes
▸ Const
secsToMs(secs
): number
Converts seconds to milliseconds
Name | Type | Description |
---|---|---|
secs |
number |
Seconds to convert |
number
Converted milliseconds
▸ Const
utcToLocal<T>(date
): T
Convert a utc date to local
Name | Type |
---|---|
T |
T : Date
|
Name | Type | Description |
---|---|---|
date |
T |
Date to use. Note that the parameter will never be mutated. |
T
A new date object with the time converted form UTC