Time
Type module
Sources
Items from Time can be imported/included and used via following ways.
/** * Import via main package * Access items like: am5.time.myVariable */import * as am5 from "@amcharts/amcharts5";
/** * Import via: Time.ts * Access items like: $time.myVariable */import * as $time from "@amcharts/amcharts5/Time";/** * Include via "index.js" * Access items like: am5.time.myVariable */Variables
Time does not have any variables.
Functions
add(array:Array,
element:A,
index?:undefined|number)Returns
voidAdds
countunits of time todate. Changesdateitself and returns it.addInTimezone(date:Date,
unit:TimeUnit,
count:number,
timezone:Timezone)Returns
Dateadd()in a named timezone: days, weeks, months and years keep the time of day on the zone's clock, smaller units add elapsed time.checkChange(timeOne:number,
timeTwo:number,
unit:TimeUnit,
utc?:undefined|false|true,
timezone?:Timezone)Returns
booleanReturns
trueif two timestamps fall in different periods ofunit, such as on different days for"day".copy(array:ArrayLike)Returns
ArrayReturns a shallow copy of the object.
Returns a copy of the
Dateobject.Returns a copy of the
Dateobject.getDateIntervalDuration(interval:ITimeInterval,
date:Date,
firstDateOfWeek?:undefined|number,
utc?:undefined|false|true,
timezone?:Timezone)Returns
numberReturns the length of
intervalin milliseconds, for the period thatdatefalls in. Days, weeks, months and years get their real length there, such as 29 days for February 2024.getDuration(unit:TimeUnit,
count?:undefined|number)Returns
numberReturns the length of
countunits of time, in milliseconds. A month counts as an average month (about 30.44 days), a year as 365 days.getTime()Returns
numberReturns current timestamp.
now()Returns
DateReturns current
Dateobject.round(value:number,
precision?:undefined|number,
floor?:undefined|false|true)Returns
numberRounds a date down to the start of its period of
countunits, such as to midnight for"day". May changedateitself.sleep(ms:number)Returns
PromiseReturns a promise that resolves after
msmilliseconds.