blob: 2565392d169c534ac3e35894f18f6d94c10f6c89 [file] [log] [blame]
This test checks the behavior of Date.prototype.toLocaleString as described in the ECMAScript Internationalization API Specification (ECMA-402 2.0).
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Date.prototype.toLocaleString.length is 0
PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleString').enumerable is false
PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleString').configurable is true
PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleString').writable is true
PASS Date.prototype.toLocaleString.call(new Date) did not throw exception.
PASS Date.prototype.toLocaleString.call() threw exception TypeError: Type error.
PASS Date.prototype.toLocaleString.call(undefined) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleString.call(null) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleString.call(0) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleString.call(NaN) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleString.call(Infinity) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleString.call('1') threw exception TypeError: Type error.
PASS Date.prototype.toLocaleString.call({}) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleString.call([]) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleString.call(Symbol()) threw exception TypeError: Type error.
PASS typeof new Date().toLocaleString() === 'string' is true
PASS new Date(NaN).toLocaleString() is "Invalid Date"
PASS new Date().toLocaleString('i') threw exception RangeError: invalid language tag: i.
PASS new Date(0).toLocaleString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' }) is "一九七〇/一/一 上午一二:〇〇:〇〇"
PASS new Date(0).toLocaleString('en', { timeZone: 'UTC' }) is "1/1/1970, 12:00:00 AM"
PASS new Date(0).toLocaleString('en', null) threw exception TypeError: null is not an object.
PASS new Date(0).toLocaleString('en', { timeZone: 'UTC', hour:'numeric', minute:'2-digit' }) is "12:00 AM"
PASS new Date(0).toLocaleString('en', { timeZone: 'UTC', year:'numeric', month:'long' }) is "January 1970"
PASS Date.prototype.toLocaleDateString.length is 0
PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleDateString').enumerable is false
PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleDateString').configurable is true
PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleDateString').writable is true
PASS Date.prototype.toLocaleDateString.call(new Date) did not throw exception.
PASS Date.prototype.toLocaleDateString.call() threw exception TypeError: Type error.
PASS Date.prototype.toLocaleDateString.call(undefined) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleDateString.call(null) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleDateString.call(0) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleDateString.call(NaN) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleDateString.call(Infinity) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleDateString.call('1') threw exception TypeError: Type error.
PASS Date.prototype.toLocaleDateString.call({}) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleDateString.call([]) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleDateString.call(Symbol()) threw exception TypeError: Type error.
PASS typeof new Date().toLocaleDateString() === 'string' is true
PASS new Date(NaN).toLocaleDateString() is "Invalid Date"
PASS new Date().toLocaleDateString('i') threw exception RangeError: invalid language tag: i.
PASS new Date(0).toLocaleDateString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' }) is "一九七〇/一/一"
PASS new Date(0).toLocaleDateString('en', { timeZone: 'UTC' }) is "1/1/1970"
PASS new Date(0).toLocaleDateString('en', null) threw exception TypeError: null is not an object.
PASS new Date(0).toLocaleDateString('en', { timeZone: 'UTC', hour:'numeric', minute:'2-digit' }) is "1/1/1970, 12:00 AM"
PASS new Date(0).toLocaleDateString('en', { timeZone: 'UTC', year:'numeric', month:'long' }) is "January 1970"
PASS Date.prototype.toLocaleTimeString.length is 0
PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleTimeString').enumerable is false
PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleTimeString').configurable is true
PASS Object.getOwnPropertyDescriptor(Date.prototype, 'toLocaleTimeString').writable is true
PASS Date.prototype.toLocaleTimeString.call(new Date) did not throw exception.
PASS Date.prototype.toLocaleTimeString.call() threw exception TypeError: Type error.
PASS Date.prototype.toLocaleTimeString.call(undefined) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleTimeString.call(null) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleTimeString.call(0) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleTimeString.call(NaN) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleTimeString.call(Infinity) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleTimeString.call('1') threw exception TypeError: Type error.
PASS Date.prototype.toLocaleTimeString.call({}) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleTimeString.call([]) threw exception TypeError: Type error.
PASS Date.prototype.toLocaleTimeString.call(Symbol()) threw exception TypeError: Type error.
PASS typeof new Date().toLocaleTimeString() === 'string' is true
PASS new Date(NaN).toLocaleTimeString() is "Invalid Date"
PASS new Date().toLocaleTimeString('i') threw exception RangeError: invalid language tag: i.
PASS new Date(0).toLocaleTimeString('zh-Hans-CN-u-nu-hanidec', { timeZone: 'UTC' }) is "上午一二:〇〇:〇〇"
PASS new Date(0).toLocaleTimeString('en', { timeZone: 'UTC' }) is "12:00:00 AM"
PASS new Date(0).toLocaleTimeString('en', null) threw exception TypeError: null is not an object.
PASS new Date(0).toLocaleTimeString('en', { timeZone: 'UTC', hour:'numeric', minute:'2-digit' }) is "12:00 AM"
PASS new Date(0).toLocaleTimeString('en', { timeZone: 'UTC', year:'numeric', month:'long' }) is "January 1970, 12:00:00 AM"
PASS successfullyParsed is true
TEST COMPLETE