mirror of
https://github.com/hanzoai/core-js.git
synced 2026-09-24 16:58:15 +00:00
17 lines
459 B
JavaScript
17 lines
459 B
JavaScript
import toISOString from 'core-js-pure/es/date/to-iso-string';
|
|
import toJSON from 'core-js-pure/es/date/to-json';
|
|
|
|
QUnit.test('Date#toJSON', assert => {
|
|
assert.isFunction(toJSON);
|
|
if (Date.prototype.toISOString) {
|
|
const date = new Date();
|
|
assert.same(toJSON(date), toISOString(date), 'base');
|
|
}
|
|
assert.same(toJSON(new Date(NaN)), null, 'not finite');
|
|
assert.same(toJSON({
|
|
toISOString() {
|
|
return 42;
|
|
},
|
|
}), 42, 'generic');
|
|
});
|