SOLVED: Use Date.parseExact OR this version according to this Bug report
DEMO using date.js
DEMO using date-en-US.js
Using the first version I get
null
http://datejs.googlecode.com/files/date.js
Line 13
when I take the assertions out of the testsuite:
// null
console.log('Date.parse("1985-04-12T23:20:50Z")',
Date.parse('1985-04-12T23:20:50Z'));
// my previous answer works
console.log('Date.parse("1985-04-12T23:20:50Z".replace(...))',
Date.parse('1985-04-12T23:20:50Z'
.replace(/\-/g,'\/')
.replace(/[T|Z]/g,' ')
)
);
// the test suite without the Z works
console.log('1985-04-12T23:20:50',
new Date(1985,3,12,23,20,50).equals( Date.parse('1985-04-12T23:20:50')));
// but this one fails when not in the test suite
try {
console.log('1985-04-12T23:20:50Z',
new Date(1985,3,12,23,20,50).equals( Date.parse('1985-04-12T23:20:50Z')));
}
catch(e) {
console.log('1985-04-12T23:20:50Z',e.message);
}
Here is an older answer for this issue when not using date.js