@@ -92,16 +92,16 @@ ecma_date_insert_num_with_sep (ecma_string_t **str_p, /**< input/output string *
92
92
} /* ecma_date_insert_num_with_sep */
93
93
94
94
/* *
95
- * The Date.prototype object's 'toString ' routine
95
+ * The Date.prototype object's 'toISOString ' routine
96
96
*
97
97
* See also:
98
- * ECMA-262 v5, 15.9.5.2
98
+ * ECMA-262 v5, 15.9.5.43
99
99
*
100
100
* @return completion value
101
101
* Returned value must be freed with ecma_free_completion_value.
102
102
*/
103
103
static ecma_completion_value_t
104
- ecma_builtin_date_prototype_to_string (ecma_value_t this_arg) /* *< this argument */
104
+ ecma_builtin_date_prototype_to_iso_string (ecma_value_t this_arg) /* *< this argument */
105
105
{
106
106
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
107
107
@@ -130,8 +130,8 @@ ecma_builtin_date_prototype_to_string (ecma_value_t this_arg) /**< this argument
130
130
else
131
131
{
132
132
ecma_number_t milliseconds = ecma_date_ms_from_time (*prim_value_num_p);
133
- ecma_string_t *output_str_p = ecma_new_ecma_string_from_number (milliseconds );
134
- ecma_date_insert_leading_zeros (&output_str_p, milliseconds, 3 );
133
+ ecma_string_t *output_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY );
134
+ ecma_date_insert_num_with_sep (&output_str_p, milliseconds, LIT_MAGIC_STRING_UTC_TIME_ZONE_U , 3 );
135
135
136
136
ecma_number_t seconds = ecma_date_sec_from_time (*prim_value_num_p);
137
137
ecma_date_insert_num_with_sep (&output_str_p, seconds, LIT_MAGIC_STRING_DOT_CHAR, 2 );
@@ -163,6 +163,21 @@ ecma_builtin_date_prototype_to_string (ecma_value_t this_arg) /**< this argument
163
163
}
164
164
165
165
return ret_value;
166
+ } /* ecma_builtin_date_prototype_to_iso_string */
167
+
168
+ /* *
169
+ * The Date.prototype object's 'toString' routine
170
+ *
171
+ * See also:
172
+ * ECMA-262 v5, 15.9.5.2
173
+ *
174
+ * @return completion value
175
+ * Returned value must be freed with ecma_free_completion_value.
176
+ */
177
+ static ecma_completion_value_t
178
+ ecma_builtin_date_prototype_to_string (ecma_value_t this_arg) /* *< this argument */
179
+ {
180
+ return ecma_builtin_date_prototype_to_iso_string (this_arg);
166
181
} /* ecma_builtin_date_prototype_to_string */
167
182
168
183
/* *
@@ -1195,21 +1210,6 @@ ecma_builtin_date_prototype_to_utc_string (ecma_value_t this_arg) /**< this argu
1195
1210
ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
1196
1211
} /* ecma_builtin_date_prototype_to_utc_string */
1197
1212
1198
- /* *
1199
- * The Date.prototype object's 'toISOString' routine
1200
- *
1201
- * See also:
1202
- * ECMA-262 v5, 15.9.5.43
1203
- *
1204
- * @return completion value
1205
- * Returned value must be freed with ecma_free_completion_value.
1206
- */
1207
- static ecma_completion_value_t
1208
- ecma_builtin_date_prototype_to_iso_string (ecma_value_t this_arg) /* *< this argument */
1209
- {
1210
- ECMA_BUILTIN_CP_UNIMPLEMENTED (this_arg);
1211
- } /* ecma_builtin_date_prototype_to_iso_string */
1212
-
1213
1213
/* *
1214
1214
* The Date.prototype object's 'toJSON' routine
1215
1215
*
0 commit comments