OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 var k = new Date(); | 139 var k = new Date(); |
140 k.setMilliseconds(); | 140 k.setMilliseconds(); |
141 k.setMilliseconds(2); | 141 k.setMilliseconds(2); |
142 assertTrue(isNaN(k.getMilliseconds())); | 142 assertTrue(isNaN(k.getMilliseconds())); |
143 | 143 |
144 var l = new Date(); | 144 var l = new Date(); |
145 l.setUTCMilliseconds(); | 145 l.setUTCMilliseconds(); |
146 l.setUTCMilliseconds(2); | 146 l.setUTCMilliseconds(2); |
147 assertTrue(isNaN(l.getUTCMilliseconds())); | 147 assertTrue(isNaN(l.getUTCMilliseconds())); |
148 | 148 |
149 // Test that toLocaleTimeString only returns the time portion of the | |
150 // date without the timezone information. | |
151 function testToLocaleTimeString() { | |
152 var d = new Date(); | |
153 var s = d.toLocaleTimeString("en-GB"); | |
154 assertEquals(8, s.length); | |
155 } | |
156 | |
157 testToLocaleTimeString(); | |
158 | |
159 // Test that -0 is treated correctly in MakeDay. | 149 // Test that -0 is treated correctly in MakeDay. |
160 var d = new Date(); | 150 var d = new Date(); |
161 assertDoesNotThrow("d.setDate(-0)"); | 151 assertDoesNotThrow("d.setDate(-0)"); |
162 assertDoesNotThrow("new Date(-0, -0, -0, -0, -0, -0, -0)"); | 152 assertDoesNotThrow("new Date(-0, -0, -0, -0, -0, -0, -0)"); |
163 assertDoesNotThrow("new Date(0x40000000, 0x40000000, 0x40000000," + | 153 assertDoesNotThrow("new Date(0x40000000, 0x40000000, 0x40000000," + |
164 "0x40000000, 0x40000000, 0x40000000, 0x40000000)") | 154 "0x40000000, 0x40000000, 0x40000000, 0x40000000)") |
165 assertDoesNotThrow("new Date(-0x40000001, -0x40000001, -0x40000001," + | 155 assertDoesNotThrow("new Date(-0x40000001, -0x40000001, -0x40000001," + |
166 "-0x40000001, -0x40000001, -0x40000001, -0x40000001)") | 156 "-0x40000001, -0x40000001, -0x40000001, -0x40000001)") |
167 | 157 |
168 | 158 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 delete Date.prototype.getUTCHours; | 335 delete Date.prototype.getUTCHours; |
346 delete Date.prototype.getUTCMinutes; | 336 delete Date.prototype.getUTCMinutes; |
347 delete Date.prototype.getUTCSeconds; | 337 delete Date.prototype.getUTCSeconds; |
348 delete Date.prototype.getUTCMilliseconds; | 338 delete Date.prototype.getUTCMilliseconds; |
349 (new Date()).toISOString(); | 339 (new Date()).toISOString(); |
350 | 340 |
351 (function TestDeleteToString() { | 341 (function TestDeleteToString() { |
352 assertTrue(delete Date.prototype.toString); | 342 assertTrue(delete Date.prototype.toString); |
353 assertTrue('[object Date]' !== Date()); | 343 assertTrue('[object Date]' !== Date()); |
354 })(); | 344 })(); |
OLD | NEW |