Skip to content

Commit 0e8cca3

Browse files
Update date documentation (#64)
Adding functionality from AssemblyScript/assemblyscript#1768
1 parent f63c012 commit 0e8cca3

File tree

1 file changed

+83
-2
lines changed

1 file changed

+83
-2
lines changed

src/stdlib/date.md

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Represents timestamps.
66

77
Represents timestamps.
88

9-
The Date API is still preliminary and requires importing the `Date` object from the host \(as `Date`\).
9+
The Date API is still preliminary with only a subset of properties and methods implemented. Note that getting the current date, via `Date.now`, requires importing the `Date` object from the host \(as `Date`\).
1010

1111
## Constructor
1212

@@ -20,7 +20,7 @@ The Date API is still preliminary and requires importing the `Date` object from
2020
* ```ts
2121
function now(): i64
2222
```
23-
Returns the current UTC timestamp in milliseconds.
23+
Returns the current UTC timestamp in milliseconds. To use this function you must import the `Date` object from the host \(as `Date`\).
2424

2525
* ```ts
2626
function UTC(
@@ -34,6 +34,11 @@ The Date API is still preliminary and requires importing the `Date` object from
3434
): i64
3535
```
3636
Returns the UTC timestamp in milliseconds of the specified date.
37+
38+
* ```ts
39+
function fromString(dateTimeString: string): Date
40+
```
41+
Creates a Date object from an ISO 8601 formatted string.
3742

3843
## Instance members
3944

@@ -46,3 +51,79 @@ The Date API is still preliminary and requires importing the `Date` object from
4651
function setTime(value: i64): i64
4752
```
4853
Sets the UTC timestamp of this date in milliseconds and returns the timestamp.
54+
55+
* ```ts
56+
function getUTCFullYear(): i32
57+
```
58+
Gets the full year according to universal time.
59+
60+
* ```ts
61+
function setUTCFullYear(value: i32): i32
62+
```
63+
Sets the full year according to universal time.
64+
65+
* ```ts
66+
function getUTCMonth(): i32
67+
```
68+
Gets the (zero indexed) month according to universal time.
69+
70+
* ```ts
71+
function setUTCMonth(value: i32): i32
72+
```
73+
Sets the (zero indexed) month according to universal time.
74+
75+
* ```ts
76+
function getUTCDate(): i32
77+
```
78+
Gets the day of the month according to universal time.
79+
80+
* ```ts
81+
function setUTCDate(value: i32): i32
82+
```
83+
Sets the day of the month according to universal time.
84+
85+
* ```ts
86+
function getUTCHours(): i32
87+
```
88+
Gets the hour according to universal time.
89+
90+
* ```ts
91+
function setUTCHours(value: i32): i32
92+
```
93+
Sets the hour according to universal time.
94+
95+
* ```ts
96+
function getUTCMinutes(): i32
97+
```
98+
Gets the minute according to universal time.
99+
100+
* ```ts
101+
function setUTCMinutes(value: i32): i32
102+
```
103+
Sets the minute according to universal time.
104+
105+
* ```ts
106+
function getUTCSeconds(): i32
107+
```
108+
Gets the second according to universal time.
109+
110+
* ```ts
111+
function setUTCSeconds(value: i32): i32
112+
```
113+
Sets the second according to universal time.
114+
115+
* ```ts
116+
function getUTCMilliseconds(): i32
117+
```
118+
Gets the millisecond according to universal time.
119+
120+
* ```ts
121+
function setUTCMilliseconds(value: i32): i32
122+
```
123+
Sets the millisecond according to universal time.
124+
125+
* ```ts
126+
function toISOString(): string
127+
```
128+
Returns the a string in simplified extended ISO 8601 format.
129+

0 commit comments

Comments
 (0)