es.date.to-primitive.js 530 B

12345678910111213
  1. var hasOwn = require('../internals/has-own-property');
  2. var redefine = require('../internals/redefine');
  3. var dateToPrimitive = require('../internals/date-to-primitive');
  4. var wellKnownSymbol = require('../internals/well-known-symbol');
  5. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  6. var DatePrototype = Date.prototype;
  7. // `Date.prototype[@@toPrimitive]` method
  8. // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive
  9. if (!hasOwn(DatePrototype, TO_PRIMITIVE)) {
  10. redefine(DatePrototype, TO_PRIMITIVE, dateToPrimitive);
  11. }