ljharb / es-abstract

ECMAScript spec abstract operations.
MIT License
114 stars 30 forks source link

ToNumber not working with Date objects #27

Closed Xotic750 closed 7 years ago

Xotic750 commented 7 years ago

https://github.com/ljharb/es-abstract/blob/master/es2015.js#L67

var value = isPrimitive(argument) ? argument : toPrimitive(argument, 'number');

seems that it should be

var value = isPrimitive(argument) ? argument : toPrimitive(argument, Number);

As according to es-to-primitive, the PreferredType should be String or Number if supplied. https://github.com/ljharb/es-to-primitive/blob/master/es6.js#L48

ljharb commented 7 years ago

Thanks, good catch.