@@ -99,7 +99,7 @@ export class Date {
99
99
this . day = _day ;
100
100
}
101
101
102
- getTime ( ) : i64 {
102
+ @ inline getTime ( ) : i64 {
103
103
return this . epochMillis ;
104
104
}
105
105
@@ -114,19 +114,19 @@ export class Date {
114
114
return time ;
115
115
}
116
116
117
- getUTCFullYear ( ) : i32 {
117
+ @ inline getUTCFullYear ( ) : i32 {
118
118
return this . year ;
119
119
}
120
120
121
- getUTCMonth ( ) : i32 {
121
+ @ inline getUTCMonth ( ) : i32 {
122
122
return this . month - 1 ;
123
123
}
124
124
125
- getUTCDate ( ) : i32 {
125
+ @ inline getUTCDate ( ) : i32 {
126
126
return this . day ;
127
127
}
128
128
129
- getUTCDay ( ) : i32 {
129
+ @ inline getUTCDay ( ) : i32 {
130
130
return dayOfWeek ( this . year , this . month , this . day ) ;
131
131
}
132
132
@@ -209,6 +209,38 @@ export class Date {
209
209
) ;
210
210
}
211
211
212
+ toUTCString ( ) : string {
213
+ const weeks : StaticArray < string > = [
214
+ "Sun, " , "Mon, " , "Tue, " , "Wed, " , "Thu, " , "Fri, " , "Sat, "
215
+ ] ;
216
+
217
+ const months : StaticArray < string > = [
218
+ " Jan " , " Feb " , " Mar " , " Apr " , " May " , " Jun " ,
219
+ " Jul " , " Aug " , " Sep " , " Oct " , " Nov " , " Dec "
220
+ ] ;
221
+
222
+ var mo = this . month ;
223
+ var da = this . day ;
224
+ var yr = this . year ;
225
+ var wd = dayOfWeek ( yr , mo , da ) ;
226
+ var year = abs ( yr ) . toString ( ) . padStart ( 4 , "0" ) ;
227
+ if ( yr < 0 ) year = "-" + year ;
228
+
229
+ return (
230
+ unchecked ( weeks [ wd ] ) +
231
+ da . toString ( ) . padStart ( 2 , "0" ) +
232
+ unchecked ( months [ mo - 1 ] ) +
233
+ year +
234
+ " " +
235
+ this . getUTCHours ( ) . toString ( ) . padStart ( 2 , "0" ) +
236
+ ":" +
237
+ this . getUTCMinutes ( ) . toString ( ) . padStart ( 2 , "0" ) +
238
+ ":" +
239
+ this . getUTCSeconds ( ) . toString ( ) . padStart ( 2 , "0" ) +
240
+ " GMT"
241
+ ) ;
242
+ }
243
+
212
244
toDateString ( ) : string {
213
245
// TODO: use u64 static data instead 4 chars
214
246
// also use stream itoa variants.
0 commit comments