2 var global = require('../internals/global');
3 var anObject = require('../internals/an-object');
4 var ordinaryToPrimitive = require('../internals/ordinary-to-primitive');
6 var TypeError = global.TypeError;
8 // `Date.prototype[@@toPrimitive](hint)` method implementation
9 // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive
10 module.exports = function (hint) {
12 if (hint === 'string' || hint === 'default') hint = 'string';
13 else if (hint !== 'number') throw TypeError('Incorrect hint');
14 return ordinaryToPrimitive(this, hint);