Time

Type module

Sources

Items from Time can be imported/included and used via following ways.

/**
 * --------------------------------------------------------
 * Import via main package: core.ts
 * Access items like: am5.time.myVariable
 *                    am5.time.myFunction()
 * --------------------------------------------------------
 */
import * as am5 from "@amcharts/amcharts5";

/**
 * --------------------------------------------------------
 * Import via: Time.ts
 * Access items like: $time.myVariable
 *                    $time.myFunction()
 * --------------------------------------------------------
 */
import * as $time from "@amcharts/amcharts5/Time";

/**
 * --------------------------------------------------------
 * Include via "index.js"
 * E.g.: "https://cdn.amcharts.com/lib/5/index.js"
 * Access items like: am5.time.myVariable
 *                    am5.time.myFunction()
 * --------------------------------------------------------
 */

Variables

Time does not have any variables.

Functions

add(

array: Array,
element: A,
index?: undefined | number

)

#

Returns void

Adds count of time unit to the source date. Returns a modified Date object.

checkChange(

timeOne: number,
timeTwo: number,
unit: TimeUnit,
utc?: undefined | false | true,
timezone?: Timezone

)

#

Returns boolean

Checks if the unit part of two Date objects do not match. Two dates represent a "range" of time, rather the same time date.

copy(

array: ArrayLike

)

#

Returns Array

Returns a copy of the Date object.

getDateIntervalDuration(

interval: ITimeInterval,
date: Date,
firstDateOfWeek?: undefined | number,
utc?: undefined | false | true,
timezone?: Timezone

)

#

Returns number

getDuration(

unit: TimeUnit,
count?: undefined | number

)

#

Returns number

Returns number of milliseconds in the count of time unit.

Available units: "millisecond", "second", "minute", "hour", "day", "week", "month", and "year".

getTime()

#

Returns number

Returns current timestamp.

now()

#

Returns Date

Returns current Date object.

round(

value: number,
precision?: undefined | number,
floor?: undefined | false | true

)

#

Returns number

"Rounds" the date to specific time unit.

sleep(

ms: number

)

#

Returns Promise

Returns a Promise which can be used to execute code after number of milliseconds.