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.
cRequired
- Type: DatetimeComponents
DatetimeComponents.
fromDate
datetime.fromDate(date: datetime);
Create a Datetime from a JavaScript Date object.
dateRequired
- Type: datetime
The JavaScript Date object.
fromIso
datetime.fromIso(iso: str);
Create a Datetime from an ISO-8601 string.
isoRequired
- 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. |
dayOfMonthRequired
dayOfMonth: num;
- Type: num
Returns the day of month in the local machine time or in utc (1 - 31).
dayOfWeekRequired
dayOfWeek: num;
- Type: num
Returns the day in month of the local machine time or in utc (0 - 6).
hoursRequired
hours: num;
- Type: num
Returns the hour of the local machine time or in utc.
minRequired
min: num;
- Type: num
Returns the minute of the local machine time or in utc.
monthRequired
month: num;
- Type: num
Returns the month of the local machine time or in utc (0 - 11).
msRequired
ms: num;
- Type: num
Returns the milliseconds of the local machine time or in utc *.
secRequired
sec: num;
- Type: num
Returns the seconds of the local machine time or in utc.
timestampRequired
timestamp: num;
- Type: num
Return a timestamp of non-leap year seconds since epoch.
timestampMsRequired
timestampMs: num;
- Type: num
Return a timestamp of non-leap year milliseconds since epoch.
timezoneRequired
timezone: num;
- Type: num
Returns the offset in minutes from UTC.
yearRequired
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. |
dayRequired
day: num;
- Type: num
Day.
hourRequired
hour: num;
- Type: num
Hours.
minRequired
min: num;
- Type: num
Minutes.
monthRequired
month: num;
- Type: num
Month.
msRequired
ms: num;
- Type: num
Milliseconds.
secRequired
sec: num;
- Type: num
Seconds.
tzRequired
tz: num;
- Type: num
Timezone offset in minutes from UTC.
yearRequired
year: num;
- Type: num
Year.