Skip to content

Commit

Permalink
[Fix] Adobe Photoshop’s JS engine bizarrely can have `+date !== date.…
Browse files Browse the repository at this point in the history
…getTime()`.

Fixes #365.
  • Loading branch information
ljharb committed Feb 21, 2016
1 parent 127fa97 commit 6352df1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion es5-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -1287,9 +1287,12 @@ var negativeYearString = '-000001';
var hasNegativeDateBug = Date.prototype.toISOString && new Date(negativeDate).toISOString().indexOf(negativeYearString) === -1;
var hasSafari51DateBug = Date.prototype.toISOString && new Date(-1).toISOString() !== '1969-12-31T23:59:59.999Z';

var getTime = call.bind(Date.prototype.getTime);

defineProperties(Date.prototype, {
toISOString: function toISOString() {
if (!isFinite(this)) {
if (!isFinite(this) || !isFinite(getTime(this))) {
// Adope Photoshop requires the second check.
throw new RangeError('Date.prototype.toISOString called on non-finite value.');
}

Expand Down

0 comments on commit 6352df1

Please sign in to comment.