Skip to content

dateplus

Luke-zhang-04 edited this page Jun 21, 2021 · 2 revisions

@luke-zhang-04/dateplus / Exports / DatePlus

Class: DatePlus

Dateplus - A class and namespace program to assist with date manipulation

Hierarchy

  • Date

    DatePlus

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DatePlus()

Inherited from

Date.constructor

Defined in

node_modules/typescript/lib/lib.es5.d.ts:882

new DatePlus(value)

Parameters

Name Type
value string | number

Inherited from

Date.constructor

Defined in

node_modules/typescript/lib/lib.es5.d.ts:883

new DatePlus(year, month, date?, hours?, minutes?, seconds?, ms?)

Parameters

Name Type
year number
month number
date? number
hours? number
minutes? number
seconds? number
ms? number

Inherited from

Date.constructor

Defined in

node_modules/typescript/lib/lib.es5.d.ts:884

new DatePlus(vd)

Parameters

Name Type
vd VarDate

Inherited from

Date.constructor

Defined in

node_modules/typescript/lib/lib.scripthost.d.ts:321

new DatePlus(value)

Parameters

Name Type
value string | number | Date

Inherited from

Date.constructor

Defined in

node_modules/typescript/lib/lib.es2015.core.d.ts:89

Properties

getVarDate

getVarDate: () => VarDate

Type declaration

▸ (): VarDate

Returns

VarDate

Inherited from

Date.getVarDate

Defined in

node_modules/typescript/lib/lib.scripthost.d.ts:326

Methods

[Symbol.toPrimitive]

[Symbol.toPrimitive](hint): string

Converts a Date object to a string.

Parameters

Name Type
hint "default"

Returns

string

Inherited from

Date.__@toPrimitive

Defined in

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:114

[Symbol.toPrimitive](hint): string

Converts a Date object to a string.

Parameters

Name Type
hint "string"

Returns

string

Inherited from

Date.__@toPrimitive

Defined in

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:118

[Symbol.toPrimitive](hint): number

Converts a Date object to a number.

Parameters

Name Type
hint "number"

Returns

number

Inherited from

Date.__@toPrimitive

Defined in

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".

Parameters

Name Type Description
hint string The strings "number", "string", or "default" to specify what primitive to return.

Returns

string | number

A number if 'hint' was "number", a string if 'hint' was "string" or "default".

Inherited from

Date.__@toPrimitive

Defined in

node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:131


addZeros

addZeros(seperator?): string

Add's 0s to date (e.g 2020/4/3 => 2020/04/03)

Parameters

Name Type Default value Description
seperator string "/" Char the date is seperatred by

Returns

string

  • Date with zeros

Defined in

src/dateplus.ts:24


formatDate

formatDate(format?, seperator?): string

Format instantiated into a string in the form YYYY{seperator}MM{seperator}DD

Parameters

Name Type Default value Description
format DateFormat "y:m:d" Format of string date
seperator string "/" Char to seperate date with

Returns

string

Formatted date

Defined in

src/dateplus.ts:35


getDate

getDate(): number

Gets the day-of-the-month, using local time.

Returns

number

Inherited from

Date.getDate

Defined in

node_modules/typescript/lib/lib.es5.d.ts:755


getDay

getDay(): number

Gets the day of the week, using local time.

Returns

number

Inherited from

Date.getDay

Defined in

node_modules/typescript/lib/lib.es5.d.ts:759


getElapsedDays

getElapsedDays(date): number

Calculates number of elapsed days between instantiated date and dae

Parameters

Name Type Description
date Date Ending date object to calculate

Returns

number

  • Number of elapsed days

Defined in

src/dateplus.ts:63


getElapsedHours

getElapsedHours(date): number

Calculates number of elapsed hours between date1 and date2

Parameters

Name Type Description
date Date Ending date object to calculate

Returns

number

  • Number of elapsed hours

Defined in

src/dateplus.ts:73


getElapsedMinutes

getElapsedMinutes(date): number

Calculates number of elapsed minutes between date1 and date2

Parameters

Name Type Description
date Date Ending date object to calculate

Returns

number

  • Number of elapsed minutes

Defined in

src/dateplus.ts:83


getElapsedMs

getElapsedMs(date): number

Calculates number of elapsed milliseconds between date1 and date2

Parameters

Name Type Description
date Date Ending date object to calculate

Returns

number

  • Number of elapsed milliseconds

Defined in

src/dateplus.ts:103


getElapsedSeconds

getElapsedSeconds(date): number

Calculates number of elapsed seconds between date1 and date2

Parameters

Name Type Description
date Date Ending date object to calculate

Returns

number

  • Number of elapsed seconds

Defined in

src/dateplus.ts:93


getElapsedString

getElapsedString(date, approx?): string

Calculates elapsed time between current and previous

Parameters

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

Returns

string

Time difference in string form, e.g "3 seconds ago"

Defined in

src/dateplus.ts:114


getFullYear

getFullYear(): number

Gets the year, using local time.

Returns

number

Inherited from

Date.getFullYear

Defined in

node_modules/typescript/lib/lib.es5.d.ts:747


getHours

getHours(): number

Gets the hours in a date, using local time.

Returns

number

Inherited from

Date.getHours

Defined in

node_modules/typescript/lib/lib.es5.d.ts:763


getMilliseconds

getMilliseconds(): number

Gets the milliseconds of a Date, using local time.

Returns

number

Inherited from

Date.getMilliseconds

Defined in

node_modules/typescript/lib/lib.es5.d.ts:775


getMinutes

getMinutes(): number

Gets the minutes of a Date object, using local time.

Returns

number

Inherited from

Date.getMinutes

Defined in

node_modules/typescript/lib/lib.es5.d.ts:767


getMonth

getMonth(): number

Gets the month, using local time.

Returns

number

Inherited from

Date.getMonth

Defined in

node_modules/typescript/lib/lib.es5.d.ts:751


getSeconds

getSeconds(): number

Gets the seconds of a Date object, using local time.

Returns

number

Inherited from

Date.getSeconds

Defined in

node_modules/typescript/lib/lib.es5.d.ts:771


getTime

getTime(): number

Gets the time value in milliseconds.

Returns

number

Inherited from

Date.getTime

Defined in

node_modules/typescript/lib/lib.es5.d.ts:745


getTimezoneOffset

getTimezoneOffset(): number

Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC).

Returns

number

Inherited from

Date.getTimezoneOffset

Defined in

node_modules/typescript/lib/lib.es5.d.ts:779


getUTCDate

getUTCDate(): number

Gets the day-of-the-month, using Universal Coordinated Time (UTC).

Returns

number

Inherited from

Date.getUTCDate

Defined in

node_modules/typescript/lib/lib.es5.d.ts:757


getUTCDay

getUTCDay(): number

Gets the day of the week using Universal Coordinated Time (UTC).

Returns

number

Inherited from

Date.getUTCDay

Defined in

node_modules/typescript/lib/lib.es5.d.ts:761


getUTCFullYear

getUTCFullYear(): number

Gets the year using Universal Coordinated Time (UTC).

Returns

number

Inherited from

Date.getUTCFullYear

Defined in

node_modules/typescript/lib/lib.es5.d.ts:749


getUTCHours

getUTCHours(): number

Gets the hours value in a Date object using Universal Coordinated Time (UTC).

Returns

number

Inherited from

Date.getUTCHours

Defined in

node_modules/typescript/lib/lib.es5.d.ts:765


getUTCMilliseconds

getUTCMilliseconds(): number

Gets the milliseconds of a Date object using Universal Coordinated Time (UTC).

Returns

number

Inherited from

Date.getUTCMilliseconds

Defined in

node_modules/typescript/lib/lib.es5.d.ts:777


getUTCMinutes

getUTCMinutes(): number

Gets the minutes of a Date object using Universal Coordinated Time (UTC).

Returns

number

Inherited from

Date.getUTCMinutes

Defined in

node_modules/typescript/lib/lib.es5.d.ts:769


getUTCMonth

getUTCMonth(): number

Gets the month of a Date object using Universal Coordinated Time (UTC).

Returns

number

Inherited from

Date.getUTCMonth

Defined in

node_modules/typescript/lib/lib.es5.d.ts:753


getUTCSeconds

getUTCSeconds(): number

Gets the seconds of a Date object using Universal Coordinated Time (UTC).

Returns

number

Inherited from

Date.getUTCSeconds

Defined in

node_modules/typescript/lib/lib.es5.d.ts:773


getWordDay

getWordDay(): string

Gets instantiated day of week in word form (e.g 0 => "Sunday")

Returns

string

Stringed day of week

Defined in

src/dateplus.ts:44


getWordMonth

getWordMonth(): string

Gets instantiated month in word form (e.g 0 => "January")

Returns

string

Stringed worded month

Defined in

src/dateplus.ts:53


setDate

setDate(date): number

Sets the numeric day-of-the-month value of the Date object using local time.

Parameters

Name Type Description
date number A numeric value equal to the day of the month.

Returns

number

Inherited from

Date.setDate

Defined in

node_modules/typescript/lib/lib.es5.d.ts:842


setFullYear

setFullYear(year, month?, date?): number

Sets the year of the Date object using local time.

Parameters

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.

Returns

number

Inherited from

Date.setFullYear

Defined in

node_modules/typescript/lib/lib.es5.d.ts:866


setHours

setHours(hours, min?, sec?, ms?): number

Sets the hour value in the Date object using local time.

Parameters

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.

Returns

number

Inherited from

Date.setHours

Defined in

node_modules/typescript/lib/lib.es5.d.ts:829


setMilliseconds

setMilliseconds(ms): number

Sets the milliseconds value in the Date object using local time.

Parameters

Name Type Description
ms number A numeric value equal to the millisecond value.

Returns

number

Inherited from

Date.setMilliseconds

Defined in

node_modules/typescript/lib/lib.es5.d.ts:789


setMinutes

setMinutes(min, sec?, ms?): number

Sets the minutes value in the Date object using local time.

Parameters

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.

Returns

number

Inherited from

Date.setMinutes

Defined in

node_modules/typescript/lib/lib.es5.d.ts:814


setMonth

setMonth(month, date?): number

Sets the month value in the Date object using local time.

Parameters

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.

Returns

number

Inherited from

Date.setMonth

Defined in

node_modules/typescript/lib/lib.es5.d.ts:853


setSeconds

setSeconds(sec, ms?): number

Sets the seconds value in the Date object using local time.

Parameters

Name Type Description
sec number A numeric value equal to the seconds value.
ms? number A numeric value equal to the milliseconds value.

Returns

number

Inherited from

Date.setSeconds

Defined in

node_modules/typescript/lib/lib.es5.d.ts:801


setTime

setTime(time): number

Sets the date and time value in the Date object.

Parameters

Name Type Description
time number A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.

Returns

number

Inherited from

Date.setTime

Defined in

node_modules/typescript/lib/lib.es5.d.ts:784


setUTCDate

setUTCDate(date): number

Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).

Parameters

Name Type Description
date number A numeric value equal to the day of the month.

Returns

number

Inherited from

Date.setUTCDate

Defined in

node_modules/typescript/lib/lib.es5.d.ts:847


setUTCFullYear

setUTCFullYear(year, month?, date?): number

Sets the year value in the Date object using Universal Coordinated Time (UTC).

Parameters

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.

Returns

number

Inherited from

Date.setUTCFullYear

Defined in

node_modules/typescript/lib/lib.es5.d.ts:873


setUTCHours

setUTCHours(hours, min?, sec?, ms?): number

Sets the hours value in the Date object using Universal Coordinated Time (UTC).

Parameters

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.

Returns

number

Inherited from

Date.setUTCHours

Defined in

node_modules/typescript/lib/lib.es5.d.ts:837


setUTCMilliseconds

setUTCMilliseconds(ms): number

Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).

Parameters

Name Type Description
ms number A numeric value equal to the millisecond value.

Returns

number

Inherited from

Date.setUTCMilliseconds

Defined in

node_modules/typescript/lib/lib.es5.d.ts:794


setUTCMinutes

setUTCMinutes(min, sec?, ms?): number

Sets the minutes value in the Date object using Universal Coordinated Time (UTC).

Parameters

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.

Returns

number

Inherited from

Date.setUTCMinutes

Defined in

node_modules/typescript/lib/lib.es5.d.ts:821


setUTCMonth

setUTCMonth(month, date?): number

Sets the month value in the Date object using Universal Coordinated Time (UTC).

Parameters

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.

Returns

number

Inherited from

Date.setUTCMonth

Defined in

node_modules/typescript/lib/lib.es5.d.ts:859


setUTCSeconds

setUTCSeconds(sec, ms?): number

Sets the seconds value in the Date object using Universal Coordinated Time (UTC).

Parameters

Name Type Description
sec number A numeric value equal to the seconds value.
ms? number A numeric value equal to the milliseconds value.

Returns

number

Inherited from

Date.setUTCSeconds

Defined in

node_modules/typescript/lib/lib.es5.d.ts:807


toDateString

toDateString(): string

Returns a date as a string value.

Returns

string

Inherited from

Date.toDateString

Defined in

node_modules/typescript/lib/lib.es5.d.ts:733


toISOString

toISOString(): string

Returns a date as a string value in ISO format.

Returns

string

Inherited from

Date.toISOString

Defined in

node_modules/typescript/lib/lib.es5.d.ts:877


toJSON

toJSON(key?): string

Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization.

Parameters

Name Type
key? any

Returns

string

Inherited from

Date.toJSON

Defined in

node_modules/typescript/lib/lib.es5.d.ts:879


toLocaleDateString

toLocaleDateString(): string

Returns a date as a string value appropriate to the host environment's current locale.

Returns

string

Inherited from

Date.toLocaleDateString

Defined in

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.

Parameters

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.

Returns

string

Inherited from

Date.toLocaleDateString

Defined in

node_modules/typescript/lib/lib.es5.d.ts:4427


toLocaleString

toLocaleString(): string

Returns a value as a string value appropriate to the host environment's current locale.

Returns

string

Inherited from

Date.toLocaleString

Defined in

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.

Parameters

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.

Returns

string

Inherited from

Date.toLocaleString

Defined in

node_modules/typescript/lib/lib.es5.d.ts:4421


toLocaleTimeString

toLocaleTimeString(): string

Returns a time as a string value appropriate to the host environment's current locale.

Returns

string

Inherited from

Date.toLocaleTimeString

Defined in

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.

Parameters

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.

Returns

string

Inherited from

Date.toLocaleTimeString

Defined in

node_modules/typescript/lib/lib.es5.d.ts:4434


toString

toString(): string

Returns a string representation of a date. The format of the string depends on the locale.

Returns

string

Inherited from

Date.toString

Defined in

node_modules/typescript/lib/lib.es5.d.ts:731


toTimeString

toTimeString(): string

Returns a time as a string value.

Returns

string

Inherited from

Date.toTimeString

Defined in

node_modules/typescript/lib/lib.es5.d.ts:735


toUTCString

toUTCString(): string

Returns a date converted to a string using Universal Coordinated Time (UTC).

Returns

string

Inherited from

Date.toUTCString

Defined in

node_modules/typescript/lib/lib.es5.d.ts:875


valueOf

valueOf(): number

Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC.

Returns

number

Inherited from

Date.valueOf

Defined in

node_modules/typescript/lib/lib.es5.d.ts:743


UTC

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.

Parameters

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.

Returns

number

Inherited from

Date.UTC

Defined in

node_modules/typescript/lib/lib.es5.d.ts:903


now

Static now(): number

Returns

number

Inherited from

Date.now

Defined in

node_modules/typescript/lib/lib.es5.d.ts:904


parse

Static parse(s): number

Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.

Parameters

Name Type Description
s string A date string

Returns

number

Inherited from

Date.parse

Defined in

node_modules/typescript/lib/lib.es5.d.ts:892

@luke-zhang-04/dateplus / Exports

@luke-zhang-04/dateplus

Table of contents

References

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

References

default

Renames and exports: DatePlus

Type aliases

DateFormat

Ƭ DateFormat: "y:m:d" | "y:d:m" | "m:d:y" | "m:y:d" | "d:m:y" | "d:y:m"

Defined in

src/utils.ts:13

Variables

daysReference

Const daysReference: Object

Reference to days of the week, zero indexed

Type declaration

Name Type
0 string
1 string
2 string
3 string
4 string
5 string
6 string

Defined in

src/values.ts:27


monthsReference

Const monthsReference: Object

Reference to months of a year, zero indexed

Type declaration

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

Defined in

src/values.ts:40


oneDay

Const oneDay: number

One day in ms

Defined in

src/values.ts:68


oneHour

Const oneHour: number

One hour in ms

Defined in

src/values.ts:63


oneMinute

Const oneMinute: number

One minutes in ms

Defined in

src/values.ts:58


values

Const values: Object

Type declaration

Name Type
hrsPerDay number
minsPerHr number
msPerSec number
secsPerMin number

Defined in

src/values.ts:17

Functions

addZeros

Const addZeros(date, seperator?): string

Add's 0s to date (e.g 2020/4/3 => 2020/04/03)

Parameters

Name Type Default value Description
date string undefined String date to format
seperator string "/" Char the date is seperatred by

Returns

string

  • Date with zeros

Defined in

src/utils.ts:44


daysToHours

Const daysToHours(days): number

Parameters

Name Type
days number

Returns

number

Defined in

src/conversions.ts:342


daysToHrs

Const daysToHrs(days): number

Converts days to hours

Parameters

Name Type Description
days number Days to convert

Returns

number

Converted hours

Defined in

src/conversions.ts:341


daysToMins

Const daysToMins(days): number

Converts days to minutes

Parameters

Name Type Description
days number Days to convert

Returns

number

Converted minutes

Defined in

src/conversions.ts:332


daysToMinutes

Const daysToMinutes(days): number

Parameters

Name Type
days number

Returns

number

Defined in

src/conversions.ts:333


daysToMs

Const daysToMs(days): number

Converts days to milliseconds

Parameters

Name Type Description
days number Days to convert

Returns

number

Converted milliseconds

Defined in

src/conversions.ts:313


daysToSeconds

Const daysToSeconds(days): number

Parameters

Name Type
days number

Returns

number

Defined in

src/conversions.ts:324


daysToSecs

Const daysToSecs(days): number

Converts days to seconds

Parameters

Name Type Description
days number Days to convert

Returns

number

Converted seconds

Defined in

src/conversions.ts:322


formatDate

Const formatDate(date, format?, seperator?): string

Format date into a string in the form YYYY{seperator}MM{seperator}DD

Parameters

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

Returns

string

Formatted date

Defined in

src/utils.ts:62


getDateValues

Const getDateValues(date, format?, seperator?): YearObj

Gets date values and outputs an object

Parameters

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

Returns

YearObj

Object with all values

Defined in

src/utils.ts:84


getElapsedDays

Const getElapsedDays(date1, date2): number

Calculates number of elapsed days between date1 and date2

Parameters

Name Type Description
date1 Date Starting date object to calculate
date2 Date Ending date object to calculate

Returns

number

  • Number of elapsed days

Defined in

src/utils.ts:140


getElapsedHours

Const getElapsedHours(date1, date2): number

Calculates number of elapsed hours between date1 and date2

Parameters

Name Type Description
date1 Date Starting date object to calculate
date2 Date Ending date object to calculate

Returns

number

  • Number of elapsed hours

Defined in

src/utils.ts:150


getElapsedMinutes

Const getElapsedMinutes(date1, date2): number

Calculates number of elapsed minutes between date1 and date2

Parameters

Name Type Description
date1 Date Starting date object to calculate
date2 Date Ending date object to calculate

Returns

number

  • Number of elapsed minutes

Defined in

src/utils.ts:160


getElapsedMs

Const getElapsedMs(date1, date2): number

Calculates number of elapsed milliseconds between date1 and date2

Parameters

Name Type Description
date1 Date Starting date object to calculate
date2 Date Ending date object to calculate

Returns

number

  • Number of elapsed milliseconds

Defined in

src/utils.ts:180


getElapsedSeconds

Const getElapsedSeconds(date1, date2): number

Calculates number of elapsed seconds between date1 and date2

Parameters

Name Type Description
date1 Date Starting date object to calculate
date2 Date Ending date object to calculate

Returns

number

  • Number of elapsed seconds

Defined in

src/utils.ts:170


getElapsedString

Const getElapsedString(start, end, approx?): string

Calculates elapsed time between current and previous

Parameters

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

Returns

string

Time difference in string form, e.g "3 seconds ago"

Defined in

src/utils.ts:191


getUtcTime

Const getUtcTime(): number

Get the current UTC Time

Returns

number

UTC Time

Defined in

src/utils.ts:249


getWordDay

Const getWordDay(numerical): string

Converts numerical day of week into word form (e.g 0 => "Sunday")

Parameters

Name Type Description
numerical 0 | 1 | 2 | 3 | 4 | 5 | 6 Numerical day of week, 0 indexed (0-6)

Returns

string

Stringed day of week

Defined in

src/utils.ts:121


getWordMonth

Const getWordMonth(numerical): string

Converts numerical month into word form (e.g 0 => "January")

Parameters

Name Type Description
numerical 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 Numerical day of week, 0 indexed (0-11)

Returns

string

Stringed worded month

Defined in

src/utils.ts:130


hoursToDays

Const hoursToDays(hrs): DaysObj

Parameters

Name Type
hrs number

Returns

DaysObj

Defined in

src/conversions.ts:305


hoursToMinutes

Const hoursToMinutes(hours): number

Parameters

Name Type
hours number

Returns

number

Defined in

src/conversions.ts:296


hoursToMs

Const hoursToMs(hours): number

Parameters

Name Type
hours number

Returns

number

Defined in

src/conversions.ts:278


hoursToSeconds

Const hoursToSeconds(hours): number

Parameters

Name Type
hours number

Returns

number

Defined in

src/conversions.ts:287


hrsToDays

Const hrsToDays(hrs): DaysObj

Converts hours to days with remainders

Parameters

Name Type Description
hrs number Hours to convert

Returns

DaysObj

Converted days

Defined in

src/conversions.ts:304


hrsToMins

Const hrsToMins(hours): number

Converts hours to minutes

Parameters

Name Type Description
hours number Hours to convert

Returns

number

Converted minutes

Defined in

src/conversions.ts:295


hrsToMs

Const hrsToMs(hours): number

Converts hours to milliseconds

Parameters

Name Type Description
hours number Hours to convert

Returns

number

Converted milliseconds

Defined in

src/conversions.ts:276


hrsToSecs

Const hrsToSecs(hours): number

Converts hours to seconds

Parameters

Name Type Description
hours number Hours to convert

Returns

number

Converted seconds

Defined in

src/conversions.ts:286


minsToDays

Const minsToDays(mins): DaysObj

Converts minutes to days with remainders

Parameters

Name Type Description
mins number Minutes to convert

Returns

DaysObj

Converted days

Defined in

src/conversions.ts:267


minsToHrs

Const minsToHrs(mins): HoursObj

Converts minutes to hours with remainders

Parameters

Name Type Description
mins number Minutes to convert

Returns

HoursObj

Converted hours

Defined in

src/conversions.ts:258


minsToMs

Const minsToMs(mins): number

Converts hours to milliseconds

Parameters

Name Type Description
mins number Minutes to convert

Returns

number

Converted milliseconds

Defined in

src/conversions.ts:240


minsToSecs

Const minsToSecs(mins): number

Converts hours to seconds

Parameters

Name Type Description
mins number Minutes to convert

Returns

number

Converted seconds

Defined in

src/conversions.ts:249


minutesToDays

Const minutesToDays(mins): DaysObj

Parameters

Name Type
mins number

Returns

DaysObj

Defined in

src/conversions.ts:268


minutesToHours

Const minutesToHours(mins): HoursObj

Parameters

Name Type
mins number

Returns

HoursObj

Defined in

src/conversions.ts:259


minutesToMs

Const minutesToMs(secs): DaysObj

Parameters

Name Type
secs number

Returns

DaysObj

Defined in

src/conversions.ts:241


minutesToSeconds

Const minutesToSeconds(mins): number

Parameters

Name Type
mins number

Returns

number

Defined in

src/conversions.ts:250


msToDays

Const msToDays(ms): DaysObj

Converts milliseconds to days with remainders

Parameters

Name Type Description
ms number Milliseconds to convert

Returns

DaysObj

Object with days, hours, minutes, seconds, and milliseconds

Defined in

src/conversions.ts:167


msToHours

Const msToHours(ms): HoursObj

Parameters

Name Type
ms number

Returns

HoursObj

Defined in

src/conversions.ts:159


msToHrs

Const msToHrs(ms): HoursObj

Converts milliseconds to hours with remainders

Parameters

Name Type Description
ms number Milliseconds to convert

Returns

HoursObj

Object with hours, minutes, seconds, and milliseconds

Defined in

src/conversions.ts:139


msToMins

Const msToMins(ms): MinutesObj

Converts milliseconds to minutes with remainders

Parameters

Name Type Description
ms number Milliseconds to convert

Returns

MinutesObj

Object with minutes, seconds, and milliseconds

Defined in

src/conversions.ts:119


msToMinutes

Const msToMinutes(ms): MinutesObj

Parameters

Name Type
ms number

Returns

MinutesObj

Defined in

src/conversions.ts:131


msToSeconds

Const msToSeconds(ms): SecondsObj

Parameters

Name Type
ms number

Returns

SecondsObj

Defined in

src/conversions.ts:111


msToSecs

Const msToSecs(ms): SecondsObj

Converts milliseconds to seconds with remainders

Parameters

Name Type Description
ms number Milliseconds to convert

Returns

SecondsObj

Object with seconds and milliseconds

Defined in

src/conversions.ts:107


secondsToDays

Const secondsToDays(secs): DaysObj

Parameters

Name Type
secs number

Returns

DaysObj

Defined in

src/conversions.ts:232


secondsToHours

Const secondsToHours(secs): HoursObj

Parameters

Name Type
secs number

Returns

HoursObj

Defined in

src/conversions.ts:223


secondsToMinutes

Const secondsToMinutes(secs): MinutesObj

Parameters

Name Type
secs number

Returns

MinutesObj

Defined in

src/conversions.ts:214


secondsToMs

Const secondsToMs(secs): number

Parameters

Name Type
secs number

Returns

number

Defined in

src/conversions.ts:205


secsToDays

Const secsToDays(secs): DaysObj

Converts seconds to days with remainders

Parameters

Name Type Description
secs number Seconds to convert

Returns

DaysObj

Converted days

Defined in

src/conversions.ts:231


secsToHrs

Const secsToHrs(secs): HoursObj

Converts seconds to hours with remainders

Parameters

Name Type Description
secs number Seconds to convert

Returns

HoursObj

Converted hours

Defined in

src/conversions.ts:222


secsToMins

Const secsToMins(secs): MinutesObj

Converts seconds to minutes with remainders

Parameters

Name Type Description
secs number Seconds to convert

Returns

MinutesObj

Converted minutes

Defined in

src/conversions.ts:213


secsToMs

Const secsToMs(secs): number

Converts seconds to milliseconds

Parameters

Name Type Description
secs number Seconds to convert

Returns

number

Converted milliseconds

Defined in

src/conversions.ts:204


utcToLocal

Const utcToLocal<T>(date): T

Convert a utc date to local

Type parameters

Name Type
T T: Date

Parameters

Name Type Description
date T Date to use. Note that the parameter will never be mutated.

Returns

T

A new date object with the time converted form UTC

Defined in

src/utils.ts:235

Clone this wiki locally