API Reference
Classes
Datetime
- Implements: ILiftable
Represents a local or UTC date object.
Methods
Name | Description |
---|---|
| Returns ISO-8601 string. |
| Returns a Datetime represents the same date in utc. |
toIso
toIso(): str
Returns ISO-8601 string.
toUtc
toUtc(): datetime
Returns a Datetime represents the same date in utc.
Static Functions
Name | Description |
---|---|
| Create a Datetime from Datetime components. |
| Create a Datetime from a JavaScript Date object. |
| Create a Datetime from an ISO-8601 string. |
| Create a Datetime from local system timezone. |
| Create a Datetime from UTC timezone. |
fromComponents
datetime.fromComponents(c: DatetimeComponents);
Create a Datetime from Datetime components.
c
Required
- Type: DatetimeComponents
DatetimeComponents.
fromDate
datetime.fromDate(date: datetime);
Create a Datetime from a JavaScript Date object.
date
Required
- Type: datetime
The JavaScript Date object.
fromIso
datetime.fromIso(iso: str);
Create a Datetime from an ISO-8601 string.
iso
Required
- Type: str
ISO-8601 string.
systemNow
datetime.systemNow();
Create a Datetime from local system timezone.
utcNow
datetime.utcNow();
Create a Datetime from UTC timezone.
Properties
Name | Type | Description |
---|---|---|
| num | Returns the day of month in the local machine time or in utc (1 - 31). |
| num | Returns the day in month of the local machine time or in utc (0 - 6). |
| num | Returns the hour of the local machine time or in utc. |
| num | Returns the minute of the local machine time or in utc. |
| num | Returns the month of the local machine time or in utc (0 - 11). |
| num | Returns the milliseconds of the local machine time or in utc *. |
| num | Returns the seconds of the local machine time or in utc. |
| num | Return a timestamp of non-leap year seconds since epoch. |
| num | Return a timestamp of non-leap year milliseconds since epoch. |
| num | Returns the offset in minutes from UTC. |
| num | Returns the year of the local machine time or in utc. |
dayOfMonth
Required
dayOfMonth: num;
- Type: num
Returns the day of month in the local machine time or in utc (1 - 31).
dayOfWeek
Required
dayOfWeek: num;
- Type: num
Returns the day in month of the local machine time or in utc (0 - 6).
hours
Required
hours: num;
- Type: num
Returns the hour of the local machine time or in utc.
min
Required
min: num;
- Type: num
Returns the minute of the local machine time or in utc.
month
Required
month: num;
- Type: num
Returns the month of the local machine time or in utc (0 - 11).
ms
Required
ms: num;
- Type: num
Returns the milliseconds of the local machine time or in utc *.
sec
Required
sec: num;
- Type: num
Returns the seconds of the local machine time or in utc.
timestamp
Required
timestamp: num;
- Type: num
Return a timestamp of non-leap year seconds since epoch.
timestampMs
Required
timestampMs: num;
- Type: num
Return a timestamp of non-leap year milliseconds since epoch.
timezone
Required
timezone: num;
- Type: num
Returns the offset in minutes from UTC.
year
Required
year: num;
- Type: num
Returns the year of the local machine time or in utc.
Structs
DatetimeComponents
Interface that is used for setting Datetime date.
Initializer
let DatetimeComponents = DatetimeComponents{ ... };
Properties
Name | Type | Description |
---|---|---|
| num | Day. |
| num | Hours. |
| num | Minutes. |
| num | Month. |
| num | Milliseconds. |
| num | Seconds. |
| num | Timezone offset in minutes from UTC. |
| num | Year. |
day
Required
day: num;
- Type: num
Day.
hour
Required
hour: num;
- Type: num
Hours.
min
Required
min: num;
- Type: num
Minutes.
month
Required
month: num;
- Type: num
Month.
ms
Required
ms: num;
- Type: num
Milliseconds.
sec
Required
sec: num;
- Type: num
Seconds.
tz
Required
tz: num;
- Type: num
Timezone offset in minutes from UTC.
year
Required
year: num;
- Type: num
Year.